#avr Logs

Mar 31 2018

#avr Calendar

12:22 AM rue_: not with microchip
12:25 AM rue_: completely different programming protocol and they changed registers too
12:25 AM rue_: so I put all the microchip stuff in a box and threw it away
12:25 AM rue_: moved to atmel
12:25 AM rue_: and there was free C, and life was good
01:59 AM * Xark notes - and as a bonus the asm ISA wasn't total crap (which makes the C run better). :)
02:00 AM tpw_rules: avr isa is wonderful
02:04 AM rue_shop3: so, flurrys i2c library is translated to C
02:04 AM rue_shop3: I think I'll test on an avr against his working library
02:04 AM rue_shop3: it should be a direct substitution
02:12 AM Xark: tpw_rules: It is pretty sweet. So much nicer than the 8-bit 6502 I wrote a shit-ton of (or pretty much any other 8-bit - with possible exception of 6809). :)
02:12 AM tpw_rules: don't you say that about 6502!!!
02:12 AM tpw_rules: :P
02:13 AM Xark: tpw_rules: I loved it at the time (avoid Intel and Zilog - until Linux days). :)
02:13 AM Xark: tpw_rules: I didn't say 6502 was bad, just avr is nicer. :)
02:13 AM tpw_rules: i only ever worked with gbz80
02:13 AM Xark: tpw_rules: That is most of a real Z80 as I understand it.
02:14 AM tpw_rules: it's closer to the 808x
02:14 AM tpw_rules: but it's pretty z80
02:15 AM Xark: tpw_rules: I mostly jumped from 6502 to 68000 and never looked back.
02:15 AM tpw_rules: 68k is good too. never done anything significant with it though
02:15 AM tpw_rules: but i wasn't alive when any of these processors were fashionable :P
02:17 AM Xark: tpw_rules: I see. I started my career on Atari 2600 (and then 8-bit home computers and on to Amiga and ST, etc.). I may be a bit older. ;)
03:18 AM polprog: morning
03:48 AM nohitzzz: morning
03:49 AM Thrashbarg: hmm
05:14 AM polprog: output speaker amplitude 4.2V and no clipping <3
05:15 AM polprog: shame i dont have a proper pushpull amp
05:15 AM nuxil: why only 5V supply and not 12+
05:15 AM polprog: https://puu.sh/zTbUw/a862380a71.png
05:16 AM polprog: opamp supply is +-8 from max232
05:16 AM polprog: blue is signal in, yellow signal out, pink is power amp out
05:16 AM nuxil: yea but make a AB driver stage and get some powa :D
05:16 AM nuxil: with mosfets
05:18 AM polprog: was thinking about that
05:18 AM MrFahrenheit: you're using a max232 as a power supply?
05:18 AM nuxil: but you need more than 5 v the
05:19 AM polprog: nuxil: this is POWAH http://farhek.com/a/a/he/heru-h-t-l-audio-power-amplifier-design_class-b-power-amplifier-theory_2-channel-amplifier-subwoofer-parallel-wiring-factory-amp-diagram-bridge-circuit-for-how-to-connect-a-car-ster.jpg
05:20 AM nuxil: hehe.
05:20 AM nuxil: that is silly :p
05:20 AM polprog: this is just to hear something. my box will just have a line out signal
05:20 AM polprog: i already have a speaker set
05:20 AM polprog: :D
05:22 AM polprog: 2KW and breadboards should not mix imo: https://www.youtube.com/watch?v=5FOKBCHeslg
05:22 AM nuxil: plsease NO
05:22 AM nuxil: D class Sucks as
05:22 AM nuxil: ass
05:23 AM nuxil: if you have somewhat respect for yourself and soundquality. stay away from D class :p
05:23 AM polprog: oh god i just read what class D
05:23 AM polprog: is
05:23 AM polprog: jesus no
05:23 AM polprog: pwming a speaker xD
05:23 AM nuxil: yea
05:24 AM nuxil: polprog, https://gyazo.com/96e9f8cd2a64f272a0a3c880af91b3ba
05:25 AM nuxil: old project i did
05:25 AM nuxil: useing lightbulbs as resistors :D
05:25 AM polprog: lol
05:25 AM polprog: nice scope
05:25 AM MrFahrenheit: polprog, also known as a one bit dac
05:26 AM MrFahrenheit: *also done with one bit dacs
05:26 AM polprog: and the best part is that my amp doesnt make a pluck when you turn it on :D
05:26 AM polprog: bbl
05:27 AM MrFahrenheit: nuxil, also, using lighbulbs was a thing for oscillators
05:28 AM MrFahrenheit: something about their non-linearity made them good for feedback
05:28 AM nuxil: yea.the orginal wienbridge used them iirc:)
05:28 AM MrFahrenheit: but they didn't light them iirc
05:29 AM nuxil: resistance in them increases as the filiment get hot. so it can be used regulating the feedback
05:30 AM nuxil: anywho. time to get go to the supermarkert and do some shopping.
05:39 AM MrFahrenheit: gotta love dhl prices on aliexpress... shipping to US? free! shipping to my country? $650
05:46 AM antto: hah, attiny817 is "xmega2" architecture
05:51 AM MrFahrenheit: figured it was released after they were bought by microchip...
06:01 AM antto: __DATA_REGION_LENGTH__ <- is this the "RAM" ?
06:45 AM antto: what is the exact meaning of these "sections" .. data bss text, etc..? i'm failing to find an explanation
06:47 AM antto: Note to self: when google gives you the finger, search on wikipedia maybe?
06:47 AM antto: is this what i should be reading? : https://en.wikipedia.org/wiki/Data_segment
06:47 AM antto: it smells like it talks about computer programs, can i assume that it also applies to avr?
06:51 AM nuxil: antto, https://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/
06:52 AM nuxil: https://www.nongnu.org/avr-libc/user-manual/mem_sections.html
06:53 AM nuxil: antto, last link
06:55 AM antto: so my global variables are either in .data or .bss depending on whether they are declared with an initial value or not?
06:55 AM nuxil: seems so
06:57 AM nuxil: and bss ends up in the ram
06:58 AM antto: but..
06:58 AM antto: what about variables in .data?
06:59 AM antto: shouldn't they also go in RAM?
06:59 AM nuxil: yea
07:00 AM nuxil: see example in last link
07:02 AM antto: so.. this atmega has XMEM (extended memory) capability, and the linker script declares stuff "optimistically"
07:02 AM antto: the chip itself has 8K ram (as per datasheet), and i don't get a warning if i declare an 8K array (amongst other things)
07:03 AM antto: i thought there is some value i can reduce to achieve this, but it looks like that's not possible because there is no "ram" section, there's stuff from both .data and .bss that will end up in RAM
07:03 AM antto: :/
07:03 AM nuxil: what options are you using when compiling?
07:05 AM antto: i'm just adjusting them now
07:06 AM antto: but basically not much extra linker flags
07:07 AM antto: i added -Wl,--defsym=__DATA_REGION_LENGTH__=0x2000
07:07 AM antto: thinking that "DATA" is ram, but now after reading this, i guess that's wrong
07:08 AM antto: on the other hand, i don't think i see a BSS section in the linker script
07:09 AM antto: oh, i see it further down..
07:14 AM antto: i see .bss ADDR(.data)+SIZEOF(.data)
07:49 AM MrFahrenheit: nuxil, I'm thinking of buying the cr10 mini printer
07:49 AM nuxil: :)
07:50 AM MrFahrenheit: since I can't find a good printer under $200 (with shipping) that means I'm bound to pay a lot of customs fees
07:50 AM nuxil: how much ?
07:50 AM MrFahrenheit: so I might as well get the cr10 mini then, since the fees don't scale linearly
07:50 AM MrFahrenheit: it's $330 + $15 shipping
07:50 AM MrFahrenheit: I expect $100-150 in fees
07:51 AM nuxil: what makes you think tarantula isnt good ? it just requre some fiddeling with :p
07:52 AM MrFahrenheit: it's not that it's not good, it's that it costs over $200 with shipping
07:53 AM nuxil: hu?
07:53 AM nuxil: did you look at ebay or aliexpress ?
07:53 AM nuxil: they offer free shipping
07:54 AM nuxil: mine costed $182 incuded shipping
07:54 AM MrFahrenheit: it's ~$240 at banggood/ebay/gearbest, and aliexpress has that one $175 offer, but then they only do dhl shipping which is $125
07:54 AM MrFahrenheit: also, I've had bad experience with dhl in the past
07:54 AM nuxil: i have only good experiance with them.
07:55 AM nuxil: i have bad experiance with our national post service :p
07:55 AM MrFahrenheit: opposite here
07:55 AM MrFahrenheit: they just charge you random fees here and I have no idea what they are
07:56 AM MrFahrenheit: "what's this $30 charge?" "that's our dhl fee" "but I paid dhl shipping already", "this is a different fee"
07:57 AM MrFahrenheit: and then there's the VAT and other customs fees on top of that
07:58 AM nuxil: heh.
07:58 AM nuxil: the thing is
07:59 AM nuxil: if you order something above your cutom limit. dhl will pay it so it gets declared.
07:59 AM nuxil: then later on you get the bill
08:27 AM MrFahrenheit: oh, the cr10 also uses avr
08:27 AM nuxil: nice
08:28 AM MrFahrenheit: the banggood promotion sale ends in a few hours, gonna have to make a decision quick
08:29 AM nuxil: what chip? mine has atmega 2560 on it
08:31 AM MrFahrenheit: not sure, can you read this https://des.gbtcdn.com/uploads/pdm-desc-pic/Electronic/image/2017/09/08/20170908152006_68831.jpg
08:32 AM nuxil: same chip ? i cant make it out
09:19 AM MrFahrenheit: nuxil, it's atmega1284p
09:20 AM nuxil: nice
09:21 AM nuxil: lots of ram
09:22 AM nuxil: 2560 has more progmem tho + more other stuff
09:22 AM nuxil: but 4mips slower
09:29 AM MrFahrenheit: I ordered it
09:30 AM nuxil: cr10
09:32 AM MrFahrenheit: mini
09:33 AM nuxil: order some filament too :p
09:33 AM nuxil: pla
09:33 AM MrFahrenheit: I think it comes with a bit of it
09:33 AM MrFahrenheit: but bad one
09:33 AM nuxil: thats gone in no time :p
09:34 AM nuxil: how many meters does it come with ?
09:35 AM MrFahrenheit: not a lot, I think
09:35 AM polprog: niceeee... i added a 50ohm impedance on the input and it all sounds awesome
09:35 AM MrFahrenheit: just enough for you to test it it, I think
09:35 AM MrFahrenheit: polprog, now check distortion
09:36 AM polprog: some distortion on zero crossing
09:36 AM MrFahrenheit: remember, if you used old parts distortion = good, if you used new parts distortion = bad
09:36 AM MrFahrenheit: that's how audio works
09:36 AM MrFahrenheit: :P
09:36 AM polprog: probably opamps fault..
09:36 AM polprog: :D
09:37 AM * polprog goes off to get some germanium trannies and hand wound resistors
09:37 AM MrFahrenheit: replace it with a 741 and call it vintage sound
09:37 AM polprog: add some 50hz line noise and call it a day
09:38 AM MrFahrenheit: but only use gold power cables
09:38 AM polprog: i always wanted to create a rack mountable digital cough and chair noise generator
09:38 AM polprog: so people can pretend they are doing a live recording
09:38 AM polprog: :D
10:05 AM nohitzzz: i found these today https://s31.postimg.org/u41l8btdn/IMG_20180331_175937.jpg
10:06 AM nohitzzz: original 2unlimited casette :D
10:07 AM nohitzzz: i cant wait to test those games
10:07 AM nohitzzz: im not even sure if i have c64 casette drive
10:08 AM nohitzzz: but those dont cost much
10:13 AM antto: 2unlimited x_x
10:13 AM antto: set that sh*t on fire
10:14 AM nohitzzz: sod off
10:15 AM * antto can't stand this retro dance music
10:30 AM polprog: i have mr puniverse for c64 on casette
10:30 AM polprog: antto: NO NO THERES NO LIMIT
10:30 AM polprog: [ pinball music video intensifies ]
10:31 AM antto: >:(
10:31 AM polprog: i recently got a cd with their greatest hits
10:31 AM polprog: not so great honestly
10:31 AM polprog: but... nice overall
10:37 AM Emil: antto: try this instead https://www.youtube.com/watch?v=ZcoqR9Bwx1Y
10:38 AM Emil: >germanium trannies :DDDDDDDDDDD
10:38 AM Emil: that's some vintage I tell ya
10:40 AM Tom_L: waste of utube space
10:44 AM polprog: Emil: stop that. this is real chiptune: https://youtu.be/R9yLJoD2hz8
11:00 AM antto: https://www.youtube.com/watch?v=_8kmDz3PFp0
11:00 AM antto: ^ i cried
11:04 AM polprog: it reminds of gmod idiot box :'(
11:06 AM MrFahrenheit: antto, https://youtu.be/ZlU8ujPraOk?t=171
11:17 AM polprog: antto: i couldnt pass the helicopter boss cos i left the boat two levels before ;_;. thats all for my halflife experience
11:25 AM nohitzzz: polprog actually not, that's sample based music
11:26 AM polprog: s/chuptune/tracker/
11:26 AM polprog: nohitzzz: https://www.youtube.com/watch?v=WmMbckRWwG8 this then. Edwin van Santen on C64 :D
11:27 AM polprog: classic
11:31 AM nohitzzz: but technically youre are right since the samples are played with this https://en.wikipedia.org/wiki/General_Instrument_AY-3-8910
11:31 AM nohitzzz: see Advanced techniques
11:32 AM polprog: interesting
11:42 AM nohitzzz: hmm seems like that tracker can use also different sound sources than that built-in chip, like external sound cartridge
11:43 AM nohitzzz: actually i doubt that the built in chip can do all those sounds at the same time
11:49 AM polprog: esp the cough sample at the beginning ;)
11:57 AM nohitzzz: i like this guy's remixes https://www.youtube.com/watch?v=3JQkW6BgUYU
11:57 AM nohitzzz: he has all kinds of weird equipment
11:59 AM MrFahrenheit: nuxil, how much do you pay for fillament?
12:02 PM nuxil: here in norway i payed for 2 rolls 30M each. 525kr about $70 incuded shipping. on ebay i have a order of 300M + 30M for about $20
12:03 PM nohitzzz: wah pedal with SID :D https://www.youtube.com/watch?v=6xdk8aQqrFU
12:04 PM MrFahrenheit: nuxil, is it that huge a price difference or did you mistype a number?
12:04 PM nuxil: no mistype
12:04 PM MrFahrenheit: wow
12:04 PM nuxil: in norway everything is fucking expensive :p
12:04 PM MrFahrenheit: also, link to the ebay item please
12:04 PM nuxil: hold on.
12:05 PM MrFahrenheit: I was looking at banggood and it's all ~$40 there
12:06 PM nuxil: oh i lied. it was about 30 buck for the one on ebay. 244Kr.
12:06 PM nuxil: https://www.ebay.com/itm/330m-1082ft-3D-Printer-Filament-ABS-PLA-1-75mm-1kg-2-2lb-Roll-MakerBot-RepRap/142619322137?ssPageName=STRK%3AMEBIDX%3AIT&var=441592832960&_trksid=p2060353.m2749.l2649
12:08 PM nuxil: 30meter costs 200 kr. here. so for 330 meter it becomes. around 2200 kr :p
12:08 PM MrFahrenheit: thanks
12:08 PM nuxil: so yea 244kr vs 2200 kr :p
12:08 PM nuxil: for same amount
12:08 PM MrFahrenheit: that's crazy
12:08 PM nuxil: yea.
12:09 PM nuxil: i live in one of the most expenisve contrys on earth i think :p
12:11 PM MrFahrenheit: and how long would a 1kg roll last
12:11 PM nuxil: but there is a big BUT
12:11 PM MrFahrenheit: I like big BUTs
12:11 PM nuxil: i have no idea how the quality of this ebay filament is.
12:13 PM nuxil: and if you order make sure you order correct size
12:13 PM nuxil: 1.75 or 3mm
12:14 PM nuxil: MrFahrenheit, i have no ide a how long 1kg lasts. i would say it all depends on how big models you plan on printing.
12:14 PM nuxil: and how much infill and such you use per model
12:16 PM MrFahrenheit: nuxil, yeah, I see how it would be hard to quantify
12:17 PM nuxil: ask Jartza about that. he has more experiance printing with his tarantula than i do. i guess he got a more general idea.
12:18 PM nuxil: im new to 3d printing myself.
12:19 PM nuxil: but i guess hes to busy printing his new fanduct atm :p
12:20 PM MrFahrenheit: I found this https://s3.amazonaws.com/makerbot-blog-old/wp-content/uploads/2012/02/MatterOfScale_V2.jpg
12:20 PM nuxil: heh
12:23 PM nuxil: im already planning on modding my printer :p
12:24 PM nuxil: adding a extra stepper motor and a 2nd lead screw on the other side on the Z axis :)
12:24 PM MrFahrenheit: always fun
12:24 PM nuxil: Up axis
12:24 PM nuxil: yea. it is
12:26 PM MrFahrenheit: I remember when 3d printing was starting up, everyone was also working on filament production methods, what happened to that
12:27 PM nuxil: idk. isnt that still a thing ? 1st abs plastic then came more friendly pla. petg and all the other stuff that you can buy.
12:28 PM nuxil: you can even print with nylon fishing line :D
12:28 PM nuxil: check this out using nylon filament. https://richrap.blogspot.no/2013/04/3d-printing-with-nylon-618-filament-in.html
12:31 PM MrFahrenheit: hah
12:32 PM nuxil: but carfule if you ever plan on doing that. nylon releases a toxi gass
12:32 PM nuxil: so vent good
12:34 PM MrFahrenheit: not gonna do that then :D
02:26 PM polprog: odd
02:26 PM polprog: my opamp seems to clip above 0V
02:26 PM polprog: +8 supply is good
02:31 PM polprog: https://puu.sh/zTrqy/11d72956be.png small gain
02:31 PM polprog: clips
02:32 PM polprog: its still amplifying the tiny DC offset but why is it clipping above 0 o_o
02:33 PM z999: Tom_L
02:53 PM MrFahrenheit: polprog, is red the input?
02:53 PM polprog: channel 3 yes
02:54 PM polprog: but i solved that
02:54 PM MrFahrenheit: so why was it clipping?
02:56 PM polprog: there was a 10 ohm resistor on the output, shorting it to ground
02:56 PM polprog: i know
02:56 PM polprog: its bad
02:56 PM MrFahrenheit: heh
02:56 PM polprog: i need to get 100k pots
02:56 PM polprog: instead of 1k
02:56 PM polprog: then that resistor would be 1k !
02:56 PM MrFahrenheit: get a decade resistance
02:57 PM MrFahrenheit: or make one, they're too expensive to buy
02:57 PM polprog: yeah. this is among 10 other things i need to get
02:57 PM MrFahrenheit: unless you get that one that uses pcb jumpers, but I have that one and it's annoying to use
02:57 PM polprog: im thinking about a cheap signal gen - im using a signal gen app right now...
02:58 PM MrFahrenheit: they're actually not hard to make, you just need a few rotary switches, they're surprisingly cheap
02:58 PM MrFahrenheit: but I've still not made one, so I don't know why I'm telling you
02:59 PM polprog: actually i got a nice set of 6 decade dials
02:59 PM MrFahrenheit: I bought a feeltech 24MHz dds generator for $70, it's good and bad but alltogether worth it
03:00 PM polprog: ill see if i can score some older but used gear
03:00 PM MrFahrenheit: I'd love that, but it seems to not really be a thing in europe
03:01 PM MrFahrenheit: every time I see some american brag about buying high grade lab equipment for a pittance, I understand the terrorists a bit more :)
03:07 PM MrFahrenheit: *note to nsa*: that was just a joke
03:26 PM tpw_rules: american terrorists are homegrown
04:03 PM Emil: Nice
04:03 PM Emil: epoll is not too bad to use
04:04 PM Emil: Also fds fucking everywhere
04:04 PM Emil: who needs signals as real jump vectors when you can just get them from a fd and multiplex with epoll <3
04:06 PM MrFahrenheit: Emil, just don't read a comparison of epoll and kqueue or you'll start hating epoll
04:06 PM MrFahrenheit: especially when you read that epoll was designed after kqueue
05:48 PM day__ is now known as day
06:46 PM antto: so the stack begins from the end of the RAM and grows towards the beginning as needed at run time?
06:48 PM Ameisen: stupid migraine
06:48 PM Ameisen: stack begins wherever you want it to, and goes in the direction you want it to.
06:49 PM Ameisen: On MCUs, people usually put the stack at the top of RAM, and have it grow down
06:49 PM antto: i was looking at this: https://www.microchip.com/webdoc/AVRLibcReferenceManual/malloc_1malloc_intro.html
06:50 PM Ameisen: You could technically put the stack right after data and have it grow up
06:50 PM antto: data and bss are fixed size (known after compilation)
06:50 PM Ameisen: would go against convention and would require the compiler to know what you're doing
06:51 PM antto: so, my __bss_end is 8098
06:51 PM antto: :/
06:51 PM antto: does this mean i got (8192-8098) bytes left for the stack?
06:54 PM cehteh: most cpus put some constraints into which direction the stack grows, at least when they have some push/pop instructions
06:55 PM antto: this is atmega2561, avrlibc, and using C++11, nothing fancy
06:55 PM cehteh: on avr's iirc the stack can only grow down when using gcc
06:56 PM antto: yes, that's all fine, i was just asking to see if i get the picture right
06:56 PM cehteh: you may change the end, but better dont
06:56 PM antto: so.. i got like 100 bytes for stack?!
06:57 PM Ameisen: cehteh - I don't recall AVR having any such instructions
06:57 PM Ameisen: and there's no reason you cannot alter GCC to have the stack grow up
06:57 PM Ameisen: Even on x86 you can have the stack grow up - you're under no obligation to use push/pop instructions
06:58 PM Ameisen: You can read/write directly to/from sp and offsets, and alter sp
06:58 PM antto: i'm not trying to change how things work
06:58 PM Ameisen: too late, I've already rebuilt your GCC for you.
06:58 PM antto: i'm just concerned about my memory usage, because i got a lot of buffers and sh*t
07:02 PM Ameisen: You should probably try to reduce your SRAM usage
07:02 PM antto: is what i said above correct?
07:02 PM antto: (the atmega has 8K ram)
07:03 PM Ameisen: If you have 8192 bytes of SRAM, and you are using 8098 of it, then you would have 94 bytes of RAM left over for anything else
07:03 PM Ameisen: including the stack
07:03 PM antto: and stack is for functions with their local variables, the deeper it goes into functions - the more stack usage grows, right?
07:04 PM antto: and that changes dynamically with program flow
07:06 PM Ameisen: The stack holds stack frames, including overflow storage for local variables.
07:09 PM antto: 94 bytes sounds like terribly few, doesn't it?
07:11 PM antto: like, if i just had an empty main() with a local buffer of 94 bytes - boom i'm ded, right?
07:12 PM Ameisen: That doesn't even fit the MS-DOS stub of a PE binary!
07:13 PM cehteh: dont forget about ISR's an inrterrupt needs to store the address where to reti at least somewhere
07:13 PM Ameisen: That, and ISRs use the stack as well, for their own frames
07:14 PM antto: yeah they are sorta functions too
07:15 PM Ameisen: I'm curious how you managed to use ~8KiB of SRAM
07:16 PM antto: easy ;P~
07:16 PM Ameisen: I _try_ to use as much RAM as possible to get more speed, and don't manage
07:16 PM Ameisen: Though I managed to fill all of my flash memory, intentionally
07:16 PM Ameisen: lots of explicit inlining to improve execution speed
07:16 PM antto: for one, i use a 4KB buffer to buffer an external eeprom
07:16 PM Ameisen: I was only using half the flash... the other half was literally being wasted.
07:16 PM Ameisen: ... why?
07:17 PM antto: because reasons
07:17 PM Ameisen: I suspect you can get away with a smaller temporary buffer and read the eeprom in chunks.
07:17 PM antto: probably, but that gets complicated
07:17 PM Ameisen: Or, write a very simple streaming compression algorithm and compress your data in the eeprom. Might end up taking more space, though.
07:17 PM antto: wut
07:18 PM Ameisen: Yes, but you are working with a device that only has 8 KiB of SRAM
07:18 PM antto: i don't think i can compress binary any more
07:18 PM Ameisen: Solutions to that are generally complicated.
07:18 PM Ameisen: You can absolutely compress the data you store in EEPROM and decompress it on the fly
07:18 PM Ameisen: the question is whether or not you benefit substantially from it
07:18 PM Ameisen: I don't know what the data is, so I can't comment on its compressability.
07:19 PM Ameisen: If it's all zeroes, then it compresses really well.
07:19 PM antto: it's patterns for a sequencer
07:19 PM Ameisen: If you know what the data usually is, roughly, you can usually design a compression algorithm for it, though it needs to be streamable for decompression.
07:19 PM Ameisen: though the actual solution here it to use a smaller streaming buffer, and implement streaming of the data.
07:20 PM antto: of course i know what the data is
07:20 PM Ameisen: akin to what 3d printers do when loading gcode for prints
07:20 PM Ameisen: which are measured in MiB
07:20 PM antto: it's all tightly packed binary data
07:20 PM Ameisen: no way you're going to store a 4 MiB gcode file in SRAM
07:20 PM antto: gcode is text
07:20 PM Ameisen: text is still data.
07:20 PM antto: pls
07:20 PM antto: ;]
07:20 PM Ameisen: Even if you convert gcode to straight binary, it will still be measured in at least hundreds of KiB
07:20 PM Ameisen: there's no way it's fitting in 8 KiB
07:21 PM Ameisen: I know this because I wrote a gcode compiler that does exactly that.
07:21 PM antto: music is a bit more critical than some gcode
07:21 PM * antto runs
07:21 PM Ameisen: stalls in gcode reading lead to your motors stalling.
07:22 PM Ameisen: And sometimes cause print failures since the velocity of a motor isn't kept up, so the next acceleration doesn't make sense, and could cause a resonance stall
07:22 PM Ameisen: wouldn't store it in EEPROM anyways, since EEPROM is slow
07:22 PM cehteh: there are a lot AVR based gcode interpreters around
07:22 PM Ameisen: cehteh - yeah, and they honestly all suck
07:22 PM Ameisen: :|
07:22 PM cehteh: maybe
07:23 PM Ameisen: I love that Marlin's uses floats for everything
07:23 PM Ameisen: not float16 extensions. Floats.
07:23 PM Ameisen: On an AVR.
07:23 PM cehteh: lol
07:23 PM antto: i was considering that too
07:23 PM cehteh: dont
07:23 PM Ameisen: I've been able to pack a lot mor einto my fork of Marlin by reworking most of their critical systems into proper modern C++, and using fixed-point arithmetic more often
07:23 PM antto: cuz i currently use 64bit integers for a certain thing
07:23 PM Ameisen: and also using uint24 more heavily
07:23 PM antto: with division and sh*t
07:24 PM Ameisen: I mean, you can't always get away from using uint64 or whatnot, but usually you can.
07:24 PM cehteh: gcode for 3d printer or mill or what?
07:24 PM Ameisen: My stuff uses uintsz_t, which is a template type I wrote in C++ where you feed it the maximum value it needs to hold (which can be derived from wherever), and it resolves to the minimally-sized type that can hold it.
07:24 PM Ameisen: 3d printer
07:24 PM antto: i tried uint32 first, it was not enough
07:24 PM Ameisen: I'm not doing mill stuff. yet.
07:25 PM Ameisen: Working on an ARM firmware
07:25 PM Ameisen: might extend it to do mill work
07:25 PM Ameisen: I'm already replicating some of the work they did in Linux CNC for smoothing paths
07:25 PM Ameisen: Tried it on AVr
07:25 PM Ameisen: AVR*
07:25 PM Ameisen: gave up.
07:25 PM cehteh: i once started some lib for rationals, maybe little better than floats
07:25 PM cehteh: never finished
07:25 PM Ameisen: AVR is too slow. The interrupts become too slow while trying to interpolate over a curve, and the motor stalls
07:25 PM Ameisen: even for really, really tight curve functions
07:26 PM cehteh: hehe
07:26 PM antto: how bout xmega at 32MHz?
07:26 PM cehteh: these days i am 3D cad'ing a new copter frame :D
07:26 PM Ameisen: The xmega isn't faster enough, most likely.
07:26 PM Ameisen: The ARM can do it trivially
07:26 PM Ameisen: hell, the ARM I'm working with has an FPU
07:26 PM cehteh: for the price of that you get a decent STM32M0
07:26 PM Ameisen: using floats is usually faster than using fixed-precision.
07:26 PM Ameisen: :|
07:27 PM cehteh: or even one with real fpu
07:27 PM cehteh: AVR's are nice, i like them, but they are not for everything
07:27 PM Ameisen: using floats also eliminates some edge-cases from fixed-precision, makes the code simpler.
07:27 PM antto: what price for a chip with fpu?
07:27 PM Ameisen: _ideally_, you have a fixed-precision type in C++ that you wrote that acts like a float so the same code can be used for either
07:27 PM Ameisen: and you just provide a typedef.
07:27 PM cehteh: floats have just other edge cases
07:27 PM Ameisen: not with fast math ;)
07:28 PM Ameisen: with fast math, you're saying "nah, those edge cases don't exist, lah lah lah"
07:28 PM cehteh: lol
07:28 PM Ameisen: In reality, you just need to check your data to make sure you aren't generating those edge cases
07:28 PM Ameisen: otherwise... bad things happen
07:28 PM Ameisen: since you're basically telling the system "operations won't result in NaN/inf"
07:28 PM Ameisen: allows a lot of optimizations, but you gotta be more careful
07:29 PM Ameisen: the cheapest STM32M4 that is on Mouser is $3.91 for 1.
07:30 PM Ameisen: Not sure if it has an FPU, I think it does
07:30 PM antto: so what happens when you got just 94 bytes left for stack, but your actual program is *plenty* complex?
07:30 PM antto: does the stack grow and start to collide with the bss/data section?
07:30 PM Ameisen: the stack will overflow into the bss
07:30 PM Ameisen: and things will get weird.
07:31 PM Ameisen: You need to use your SRAM more sanely. Like not using 4KiB storage buffers.
07:31 PM Ameisen: when you only have 8 KiB, you have to stream data.
07:31 PM Ameisen: It isn't really optional
07:31 PM antto: i need the 4KB buffer
07:31 PM antto: i can get rid of other things
07:31 PM Ameisen: Why do you need it?
07:32 PM antto: i have other big buffers that are actually constants, i can move them to progmem or somethin
07:32 PM rue_: so your program is not using streamable data
07:32 PM antto: i need the buffer to get rid of a potential 20ms delay in one specific edge case
07:33 PM antto: because my program is a "clone" of an older device, which uses static ram (battery backed) for that same data, and it doesn't have this problem
07:35 PM antto: a 20ms glitch in music is basically a party killer
07:35 PM antto: ;P~
07:36 PM Ameisen: Why are you using EEPROM for this
07:36 PM Ameisen: seems like external flash would be more appropriate
07:36 PM antto: i actually replaced my eeprom with FRAM
07:36 PM antto: but the device has an EEPROM by design
07:37 PM antto: and 99.9% of the users have eeproms in theirs
07:46 PM antto: tom eye tea eks
07:48 PM Ameisen: I do think AVR would be substantially better if they'd added slightly better 2-byte support instructions (for pointers), and fixed-size shifts
07:48 PM Ameisen: Hell, just having an atomic 2-byte add/subtract would actually make almost all AVR programs dramatically faster
07:49 PM antto: i had the impression that xmega has some 2-byte things
07:49 PM antto: ah, no, not that kind
07:49 PM Ameisen: since every new stack frame wouldn't require a disable/enable interrupts at the start to alter the stack pointer
07:53 PM antto: i wonder if there's a way to check if my stack has reached the bss
07:54 PM Ameisen: Put a canary value after the BSS. If the canary changes value, you have.
07:54 PM Ameisen: I suspect you will clobber the BSS almost immediately
07:54 PM antto: like, allocate a small buffer and place it at the very end of the bss with special values
07:54 PM Ameisen: You could also set up an interrupt on a timer, and have it check the stack pointer's address
07:54 PM Ameisen: though that interrupt will also use the stack.
07:55 PM antto: hm
10:33 PM z999: Tom_L
10:36 PM Tom_L: mmm?
10:36 PM nuxil: Tom is Low. hack him high, Tom_H
11:26 PM rue_ is now known as rue_mohr
11:37 PM day__ is now known as day
11:43 PM rue_mohr: arg
11:43 PM rue_mohr: opencm3
11:44 PM rue_mohr: when you call "set bit 4" it CALL A FUNCTION that CALLS A FUNCTION that sets the bit
11:44 PM rue_mohr: so, well over 12 instructions with pushes/pops
11:46 PM rue_mohr: something else is amyss