#avr Logs

Oct 17 2017

#avr Calendar

12:00 AM day__ is now known as daey
01:53 AM l9_ is now known as l9
05:05 AM Pi3rrot: thanks to all for answers ;)
05:06 AM Pi3rrot: i'm using the util/delay.h wich is using math.h. __float128 is provided by this lib
05:43 AM Emil: polprog: it's rather hard to measure how long an operation takes
05:43 AM Emil: polprog: unless you confirm the assembly by hand
05:43 AM Emil: because the compiler is free to move shit around
06:13 AM polprog: Emil: agreed
08:11 AM thardin: there's __int24 but not __int48?
08:11 AM thardin: sad!
08:14 AM Thrashbarg: what a shame there's no __int36
08:17 AM LeoNerd: Well, 36 isn't a multiple of 8
08:18 AM Thrashbarg: it was common on mainframes and minicomputers though ._.
08:18 AM LeoNerd: Given as the AVR is an entirely 8bit processor, 24 is just as valid to synthesize as 16 or 32
08:18 AM LeoNerd: But 36 would be harder as it involves half-bytes
08:18 AM Thrashbarg: as is 48 hehe
08:21 AM thardin: no it isn't
08:21 AM thardin: 40 and 56 bit would be nice too
08:22 AM thardin: but maybe a bit annoying to write all those multiplication asm variants
08:22 AM thardin: say 24*16 -> 40-bit
08:23 AM Thrashbarg: 48 != 8 bit multiple?
08:24 AM thardin: 48 = 6*8
08:24 AM Thrashbarg: yes I know. I don't know what you're referring to by <thardin> no it isn't
08:25 AM thardin: hmm. mabye I brain-farted
09:31 AM rue_mohr: there's a float128!?
09:42 AM thardin: maybe? you could always use GMP
11:13 AM robinak is now known as robink
11:35 AM Tom_L: o i
12:08 PM polprog: this is odd. my rs232 port in the PC sends data but fails to receive it. (loopback test fails but i can see the Tx line on the scope)
12:33 PM polprog: looks like the serial port just refuses to work
01:29 PM Lambda_Aurigae: polprog, hooking tx to rx directly on the rs232 port and nothing else...and loopback fails?
01:29 PM Lambda_Aurigae: connect serial terminal with that loop and see if you see data returned when typed into serial terminal.
01:58 PM polprog: Lambda_Aurigae: that's what i did
01:58 PM polprog: testing with a serial terminal
01:58 PM polprog: isn't that called loobpack test :P?
02:03 PM pingec is now known as pingo
02:08 PM Lambda_Aurigae: pretty much.
02:08 PM Lambda_Aurigae: just was checking.
02:08 PM Lambda_Aurigae: if that fails then you likely have something wrong with your serial port.
02:08 PM polprog: i will just get some pci-rs232 adapter, i may even have one
02:10 PM Lambda_Aurigae: you using one on the motherboard or a usb adapter?
02:10 PM polprog: motherboard port
02:11 PM polprog: i dont have RS232-usb adapter, only uart-usb
02:11 PM Lambda_Aurigae: usb to ttl(5v or 3.3v) eh?
02:11 PM Lambda_Aurigae: I have half a dozen of each, 5V, 3.3V, and rs232 level
02:11 PM Lambda_Aurigae: collected them over the years.
02:13 PM polprog: i saw some ancient box with a usb and a db-9, from the times when round semi-transparent cases were the design to have
02:13 PM polprog: but i didnt get it
02:13 PM Lambda_Aurigae: aaww
02:13 PM Lambda_Aurigae: those are fun!
02:13 PM Lambda_Aurigae: I have one old one that has a max233 in it next to the usb-serial chip
02:13 PM polprog: so far i armed myself in gender changers and a 5 meter rs232 nullmodem cable
02:14 PM Lambda_Aurigae: I kinda frankensteined it and tapped the 5V lines between the two chips.
02:14 PM polprog: and i managed to put together the max232 board
02:14 PM polprog: so, if anything else fails, ill just use the existing 3v3 uart dongle i have
02:14 PM Lambda_Aurigae: I prefer max233 myself...bit more expensive than the chip and the caps, but, fewer parts.
02:15 PM polprog: max233? ill lokk into that
02:15 PM Lambda_Aurigae: just like a max232 but it has the caps built in.
02:15 PM Lambda_Aurigae: and is about 3 times the price.
02:15 PM LeoNerd: Does anyone have any suggestions on a good small USB-based AVR programmer, suitable to be mounted on a cable directly..?
02:15 PM Lambda_Aurigae: 7 dollars versus 2.
02:16 PM Lambda_Aurigae: LeoNerd, I would make one myself if I needed such...ask me that again in about 4 to 5 hours and I can look it up for you.
02:16 PM Lambda_Aurigae: gotta go back to work at the moment.
02:16 PM polprog: my eventual plan is to implement a multidrop rs485 bus
02:16 PM LeoNerd: Eh; I really can't be bothered to put the time in to make it. I'd rather buy one
02:16 PM polprog: have fun ;)
02:58 PM LeoNerd: Does anyone know: the default printf() implementation you get on avr-libc, does it support %*s ?
02:58 PM LeoNerd: It doesn't appear to for me, it just stops at that point
03:01 PM LeoNerd: Oh.. no :(
03:02 PM LeoNerd: The variable width or precision field (an asterisk * symbol) is not realized and will to abort the output. <== says the docs
03:04 PM Emil: aww
03:05 PM LeoNerd: Yeah that's annoying actually... %*s of a length/buffer pair is a common use-case :(
03:06 PM LeoNerd: Hrm - I'm on the avr-gcc list.. I wonder if avr-libc questions are ontopic there
03:07 PM LeoNerd: Oh. .. hah.
03:07 PM LeoNerd: I commented on that in the mailing list a year ago
03:07 PM LeoNerd: nobody replied :(
03:07 PM polprog: sad
03:08 PM polprog: avr google group is dead, apropos.
03:08 PM polprog: full of sex ads
03:08 PM LeoNerd: Mmm
03:11 PM LeoNerd: See also http://lists.nongnu.org/archive/html/avr-gcc-list/2016-07/msg00000.html
03:13 PM polprog: so %s prints a char pointer contents. but what does the * do there?
03:15 PM LeoNerd: printf("%.*s", 5, "Hello world"); will print only the first 5 characters, i.e. "Hello"
03:15 PM polprog: nice
03:15 PM polprog: good to know
03:15 PM LeoNerd: This is really useful for printf("%.*s", length, buffer) <== if buffer is not NUL-terminated
03:15 PM polprog: i'd just use a small loop with putchar though as a workaround
03:16 PM LeoNerd: Yes but that's inconvenient in otherwise oneliners of printf...
03:16 PM polprog: agreed
03:16 PM polprog: but i find the printf implementation poor
03:16 PM LeoNerd: Especially as the libc will already parse "%.5s", "Hello world" just fine
03:16 PM LeoNerd: This is honestly a ~5 line code change to vfprintf.c
03:17 PM LeoNerd: Perhaps I'll just mail them a patch anyway
03:17 PM polprog: yeah
03:17 PM LeoNerd: I normally dislike doing that unless someone has said "yes do it"
03:17 PM LeoNerd: Because usually that means nobody will accept it anyway after I send it so why bother?
03:17 PM polprog: what they are using? just mailing patches in or something more civilised like git?
03:17 PM polprog: s/git/github/
03:17 PM LeoNerd: savanaha
03:18 PM LeoNerd: But that doesn't matter
03:18 PM polprog: no idea what's that but whatever
03:18 PM LeoNerd: If nobody has replied to my mail in a year to say "yes", will anybody be around to accept my patch anyway?
03:18 PM LeoNerd: regardless of the mechanism I use to send it
03:18 PM polprog: make a leonerd-avr-libc branch
03:18 PM polprog: :P
03:18 PM LeoNerd: I really can't be bothered
03:18 PM LeoNerd: next debian update would overwrite it
03:18 PM LeoNerd: I'd be forever playing catchup
03:19 PM LeoNerd: It's a *huge* amount of faff
03:19 PM * LeoNerd really just likes complaining about $upstream "maintainers" who aren't
03:19 PM LeoNerd: Oh... turns out there's an avr-libc list
03:19 PM LeoNerd: I'll mail it to them
03:19 PM polprog: im listening to KLF remix of trump saying trump stuff
03:23 PM LeoNerd: Ooooh this is interesting
03:24 PM LeoNerd: width and prec are both 'char'
03:24 PM LeoNerd: Meaning, you can't printf("%500s", str) for example
03:26 PM LeoNerd: I wonder if that ought to be fixed too... eats two more stack bytes while it does though
03:26 PM polprog: so the number can be olny 8-bit [char-wide] ?
03:27 PM polprog: huh
03:27 PM polprog: what width is a pointer in avr?
03:28 PM LeoNerd: I'd imagine 16 bits
03:29 PM LeoNerd: I don't know of any AVR with more than 64Ki RAM
03:29 PM LeoNerd: http://paste.debian.net/991337/ well there we go
03:29 PM LeoNerd: That Was Not Hard
03:30 PM polprog: heh
03:31 PM polprog: i assume you tried different compilation opts?
03:31 PM LeoNerd: I prediced 5 line patch. It's 6 but one of the lines is just a close-brace
03:31 PM LeoNerd: Hrm?
03:31 PM LeoNerd: The code is not implemented at all, anywhere right now. This is me adding it
03:31 PM polprog: http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e4649092b9f1
03:31 PM LeoNerd: Yes I'm aware
03:31 PM LeoNerd: I'm looking at the code that implements it :)
03:31 PM LeoNerd: It is not there
03:32 PM polprog: it says there "The variable width or precision field (an asterisk * symbol) is not realized and will to abort the output"
03:32 PM polprog: so they just didnt want it to be there :<
03:32 PM LeoNerd: Well,... it's unclear
03:32 PM LeoNerd: That's whyI want to ask
03:32 PM LeoNerd: Do you *intend* this to be absent [and if so why??], or is it just that nobody got around to it yet?
03:32 PM LeoNerd: If the latter, then here, have this
03:33 PM polprog: that reminds me i should put the format strings in the progmem part.... there's vprintf_P for that
03:33 PM LeoNerd: Hah
03:33 PM LeoNerd: *Yah
03:33 PM LeoNerd: It really cuts down on the RAM usage
03:33 PM polprog: maybe that will ease the job for ram.
03:34 PM polprog: im not sure if i got rid of all dynamic allocations yet
03:34 PM polprog: no i did not
03:34 PM polprog: well, that goes on the todo list
03:35 PM polprog: recently the nice part of fw development started
03:35 PM polprog: when you have all the low level functions defined and you just use them
03:35 PM polprog: i could define a func / macro for bringing down and up the SS pins
03:35 PM Cracki: printf_P() and if you have progmem string args, those are %S
03:35 PM polprog: but meh
03:35 PM Cracki: PSTR() all the strings
03:36 PM polprog: Cracki: thanks for the heads up
03:36 PM Cracki: you can __flash various tables/arrays too
03:36 PM Cracki: completely transparent access (not like eeprom...)
03:36 PM polprog: i know
03:36 PM Cracki: :)
03:36 PM polprog: PROGMEM is a gift on low ram things like those :D
03:36 PM Cracki: necessity even
03:37 PM Cracki: I have math tables and tons of strings in flash
03:37 PM Cracki: ram is for task stacks
03:37 PM polprog: like such attiny 4 with 256 byte sram
03:37 PM polprog: tiiiiny
03:37 PM Cracki: ugh
03:38 PM Cracki: I'd imagine only a cat would sit on that
03:38 PM polprog: it's probably th kind of a chip that has to receive a packet of serial data and control like 1 or two leds, being only the part of a bigger system
03:39 PM polprog: like, 10k of them in a single big installation
03:39 PM Cracki: hmmm
03:39 PM LeoNerd: I suppose I should build this and test to see if it actually works
03:40 PM polprog: would be a disgrace if you submitted a patch that doesnt work lol
03:42 PM LeoNerd: I've sent them a "well here's a patch but I've not tested it yet" - a good getout clause in case it doesn't while still suggesting what I intend
03:42 PM polprog: here's a patch: "//TODO: implement %*.s
03:43 PM Cracki: ^
03:43 PM Cracki: %*.s? I'd think that was implemented
03:43 PM Cracki: perhaps as %-*s or %*s
03:43 PM LeoNerd: None of them currently are
03:43 PM Cracki: I doubt that
03:44 PM LeoNerd: The printf format parser hard-aborts on any unrecognised character; the * is not in the set of recognised ones
03:44 PM LeoNerd: Well if you want I can pastebin the vfprintf.c file and you can look for yourself
03:44 PM LeoNerd: If I have missed it, you can tell me the line number(s) that implement it
03:44 PM Cracki: lemme check. I *thought* I used that before on avr...
03:44 PM Cracki: ugh
03:44 PM Cracki: hell, they should implement that
03:44 PM LeoNerd: Yes I'm aware
03:44 PM * LeoNerd has emailed the list about it now
03:45 PM Cracki: I'm gonna believe you ^^
03:45 PM LeoNerd: Oh I forgot to 'continue';
03:45 PM polprog: lol
03:45 PM LeoNerd: So I parsed it then aborted as an error anyway :P
03:46 PM * LeoNerd unrelatedly, mumbles about socat
03:58 PM LeoNerd: Ohman I need to download 800MB of latex implementation just so I can debuild the avr-libc package :/
04:06 PM Cracki: lol
04:06 PM Cracki: don't build the docs then
04:06 PM Cracki: if you can avoid it
04:07 PM LeoNerd: I don't think I can for the debian wrapping
04:07 PM Cracki: you should have a latex distribution anyway. lots of shit wants it.
04:07 PM Cracki: install pandoc too, hella handy
04:07 PM Cracki: markdown to latex pdf, it's nice
04:08 PM Cracki: markdown (with table syntax of course) with inline latex. I think I'll write my thesis like that.
04:17 PM polprog: night
04:38 PM LeoNerd: Woo. My first attempt at having an AVR write EEPROM appears to be working
04:38 PM LeoNerd: I can powercycle my voltmeter and it remembers the zero offset calibration :)
04:38 PM polprog: nice
04:39 PM polprog: night
04:39 PM polprog: gotta be at school at 700 tomorrow
04:39 PM polprog: :<
04:43 PM Emil: LeoNerd: wait
04:43 PM Emil: LeoNerd: you mean the internal eeprom?
04:53 PM LeoNerd: Yah
04:53 PM LeoNerd: ... annoyingly I then trashed it next time I uploaded code, because I forgot about EESAVE fuse. Oopsie
04:55 PM Emil: wtf
04:55 PM Emil: Are we going back in time?
04:56 PM LeoNerd: Hm?
05:02 PM LeoNerd: Ah oopsie :)
05:03 PM LeoNerd: Now that I have zero offset calibration, the display can read down to 0V input.
05:03 PM LeoNerd: Which means that my dBV units conversion gets upset and crashes the thing ;)
05:03 PM polprog: cant have false readings if you dont have any readings :)
05:04 PM LeoNerd: Well.. 0V == -Inf dBV
05:04 PM LeoNerd: I should specialcase it
05:10 PM LeoNerd: Hrm.. I wonder what the display ought to show for 0V when in dBV mode
05:28 PM Emil: LeoNerd: how have you not used eeprom before
06:14 PM Cracki: -inf?
06:14 PM Cracki: that's what it ought to show
06:40 PM Cracki: reading https://en.wikipedia.org/wiki/Level_(logarithmic_quantity) and https://en.wikipedia.org/wiki/Decibel helped me understand
06:41 PM Cracki: didn't realize the definitions were about field quantities and power until now
07:03 PM LeoNerd: Emil: not before today, no, well, not writing anyway.. reading
07:05 PM LeoNerd: Cracki: oh, indeed. but it's more that I'd need to work out exact pixel placement, draw some more glyphs,...
07:06 PM Cracki: ic
07:06 PM LeoNerd: 128x32 OLED
07:07 PM LeoNerd: Seen here: https://twitter.com/cpan_pevans/status/915330882457743360?s=09
07:08 PM Cracki: those are a lot of digits :P
07:08 PM LeoNerd: Mmmmhm. In volts mode they're almost all trustworthy.. the final one is give or take about 3
07:09 PM LeoNerd: In dB mode I still need to have it determine how many digits are worthy... fewer than all and depends on reading
09:12 PM tpw_rules: LeoNerd: what are you using to do the reading
11:59 PM day__ is now known as daey