#avr Logs

Feb 25 2019

#avr Calendar

06:37 AM rewolff: Hi, Does anybody know if I can read part of flash-or-eeprom with AVRDUDE? I need to read the first 4 bytes of eeprom, and it is reading all of it and taking a long time....
06:41 AM polprog: avrdude has a terminal mode which can do that
06:41 AM polprog: https://linux.die.net/man/1/avrdude
06:49 AM rewolff: Yeah. So... from my script I need to start terminal mode and pipe commands to it?
06:49 AM polprog: most likely
06:50 AM rewolff: Sigh
06:50 AM polprog: its not bad
06:51 AM rewolff: Experimenting with terminal mode is bad. I can manage to type for a few mintues with one hand, But securing the programming pogopins to the board requires two hands. And I don't have three. :-(
06:52 AM rewolff: I have a script: read the ID, if that fails start over. When it succeeds 4 times in a row, the programming connector is stable and programming can start... .
07:21 AM rewolff: Anyway. For now I've waited out the delays of unnecessarily reading out the rest of the eeprom, for next time I know what I need to look into.
07:21 AM rewolff: Thanks for the help.
07:37 AM shanee: Hi. Has anyone tried installing an old version of avr-gcc on Ubuntu? I have some software that requires an older version to build but am struggling to figure out how to do this.
07:47 AM cehteh: why does it require the older version? often its simple to fix errors/warnings for new compilers
07:51 AM shanee: cehteh, Filesize grew by 20% from 4.8 -> 5.4 so it doesn't fit the microcontroller anymore. :/
07:51 AM cehteh: then you did something wrong, when i changed to new compiler things shrunk
07:52 AM cehteh: try -flto and -Os
07:52 AM cehteh: and do proper void/const declarations
07:52 AM cehteh: give the compiler more opporutinty to optimize
07:53 AM splud: shanee - is it being invoked with the same options?
07:54 AM splud: with different optimizations, I've seen code size vary > 200%
07:55 AM cehteh: even then bad code may grow when it isnt properly declared and the compiler is more pedantic about correctness
07:55 AM cehteh: my stuff here grows 1000% w/o right flags :D
07:56 AM splud: Also, are you buiilding a stand-alone program, or something making use of external libraries.
07:57 AM splud: difference in library revisions can lead to significant program size changes. Some libs declare massive buffers..
08:00 AM shanee: It's the same flags and script. Although it's possible some of them might have been removed/renamed? I'm already using -flto.
08:01 AM rewolff: One trick might be to install an older ubuntu in a chroot.
08:01 AM rewolff: look into "debootstrap" on how to do that.
08:02 AM shanee: It's using the standard libc only (and some "avr/..." and "util/..." stuff, but nothing 3rd party).
08:03 AM shanee: The size increase is only 2046 -> 2216 (so 10% actually). So not too bad. However, the device only has space for 2048 bytes.
08:04 AM shanee: Chroot or VM seems like a really good way to go. I'll give this a go next. :) (I'd kind of forgotten a chroot was a thing!)
08:15 AM rewolff: FYI: I have a bunch of STM32 applications that refuse to compile on Ubuntu 18.04 while they work on 16.04. Or rather they compile fine, but then crash on the target. I've narrowed it down to the "standard libc".... Compiling the application code on 16.04 but linking on 18.04 creates a bad binary and compiling my code on 18.04 and then linking with the libc on 16.04 makes it work.... .
08:15 AM rewolff: So I'm not ruling out "standard libc" being the problem.
08:16 AM rewolff: BTW: Unless you're building millions (and even then...) I would tell production to go get a bigger CPU when you're at 2046/2048....
08:22 AM shanee: rewolff, Ah. I already have a bunch soldered. Just working on cramming in extra features I didn't originally plan for. :W
08:39 AM ac_slater: y hey guys I have an AVR32 question - I know it's not as popular as the AVR8 ships. I'm configured as SPI master, all works well except I need to clear the Rx FIFO and can't seem to figure it out.
08:40 AM ac_slater: the manual states I can clear it by "writing a one to the Flush Fifo Command bit in the CR register (CR.FLUSHFIFO)"
08:41 AM ac_slater: I have access to that register (as it's used for initialization). So right before reading (chip select + read), I try to do `spi->cr &= AVR32_SPI_CR_FLUSHFIFO_MASK`
08:42 AM ac_slater: and that mask is 0x00001000
08:43 AM ac_slater: my problem is my slave sends me a byte for every byte I send it. But, with this Rx FIFO, I need to write 4 bytes before *I see* it's return bytes. The AVR32 U3C3 manual states there is a 4-character buffer
08:50 AM rue_mohr: wrong flag?
08:50 AM rue_mohr: buffer full vs character recieved
08:50 AM ac_slater: rue_mohr: I think it's the right flag
08:51 AM ac_slater: rue_mohr: the manual is very terse about clearing the buffer, so maybe I am doing that correctly
08:52 AM rewolff: shanee: Well... Especially for the prototype runs I have learned to try to buy the bigger devices. The cost of the bigger CPU is MUCH less than what you're spending in extra time now even when it is just a hobby project.
08:52 AM rewolff: (and 2k is probably the smallest, so a larger version exists. :-) )
08:53 AM shanee: rewolff, True.
08:54 AM rewolff: ac_slater: try reading the dataregister 3 or 4 times before starting to send any data.
08:54 AM rewolff: That should clear the fifo.
08:54 AM ac_slater: rewolff: yea that does work. I just wish I didnt have to :-/
08:55 AM rewolff: At least that will (go back, change does!) tell you that there is something left in the FIFO.
08:55 AM shanee: If I use only interrupts and don't allow interrupts during other interrupts, can I make all the interrupts "naked"? (I think push/pop is mostly used to avoid breaking code in the main loop, which doesn't exist in this case).
08:55 AM rewolff: So either a previous transaction is not reading all the data, OR, as I've experienced on a differnet chip: The fifo does not properly reset when the device powers up.
08:56 AM ac_slater: rewolff: oh interesting, I'll try clearing on boot.
08:56 AM rewolff: shanee: That would be VERY dirty, but could work. :-)
08:58 AM rewolff: I would advise against it from a software engineering point-of-view. Chances you wanting to put something simple in the while(1); loop at the bottom of main () is real. That'll happen when you've forgotten you've broken normal execution for the main program.
09:02 AM rue_mohr: everything is going arm anyhow, I really wonder how long avr32 will live
09:03 AM nohit: its legacy product already
09:03 AM nohit: on microchip webpage
09:04 AM day: who even cares about the isa?
09:05 AM rue_mohr: I'd rather spend my time fighting with stm32 than avr32
09:05 AM rue_mohr: atleast if the stm32 goes, I can shuffle over to 1/10000000 other chips
09:05 AM ac_slater: AVR32 is super simple
09:06 AM day: well if you are tinkering in asm i can understand that. but if you write C/ C++ you dont notice much of the isa anyways do you?
09:06 AM ac_slater: in design, as opposed to anything STM32
09:06 AM rue_mohr: as for avr itself, microchip will be gradually screwing it all up,
09:06 AM day: it just works (tm) :)
09:06 AM rue_mohr: apparently the newer supercheap chips are 8051 core
09:07 AM rue_mohr: if 8051 hasn't gone away by now, maybe it never will...
09:08 AM day: the price pressure on 8bit archs must be immense these days, seeing for how cheap ARM cores sell
09:09 AM rue_mohr: yea
09:09 AM day: and with each little bit of lost marketshare it gets harder
09:09 AM rue_mohr: I think its insane to think an stm32 blue pill costs less than an arduino
09:09 AM rue_mohr: there are still projects so simple I dont want to use an avr tho
09:10 AM day: as in solve it with discrete parts?
09:10 AM rue_mohr: hah
09:10 AM rue_mohr: funny you say that
09:10 AM nohit: ST released new low cost series few months ago, they beat pretty much every AVR in spec and cost 80cents
09:10 AM day: i mean what would be your avr step down?
09:10 AM rue_mohr: cause the thought I had was using a t13 instead of a 555
09:10 AM nohit: G0 series
09:11 AM rue_mohr: nohit, but I do not want to take on another arch
09:11 AM rue_mohr: is it 8051?
09:11 AM day: nohit: sounds interesting. problem is, linux supported toolchain?
09:12 AM ac_slater: rue_mohr: I found out there is a fifo enable bit I can flip off
09:12 AM nohit: M-0+
09:12 AM nohit: stm32
09:13 AM nohit: arm-gcc toolchain
09:13 AM rue_mohr: G0 is arm?
09:13 AM nohit: same as every cortex-m/r/a
09:13 AM day: ah
09:13 AM nohit: yes
09:13 AM rue_mohr: haha
09:13 AM day: yeah thats nice ofc.
09:14 AM nohit: https://www.st.com/content/st_com/en/about/media-center/press-item.html/p4117.html
09:14 AM rue_mohr: I'll wait till there is a carrier baord from ali
09:17 AM rue_mohr: https://www.aliexpress.com/item/For-WeMos-D1-SAMD21-M0-Mini-USB-For-ARM-Cortex-M0-32-Bit-Extension-For-Arduino/32948700890.html
09:17 AM rue_mohr: ?
09:17 AM rue_mohr: price is out in the troposphere tho
09:29 AM mitxela: Hi folks, am I going crazy or did avrdude use to have an option to print the current fuses at the end of every operation? was this something that got removed?
09:30 AM mitxela: with safe mode on it is already reading the fuses anyway
09:38 AM rewolff: You can get the carrier board from Mouser at about $10.
09:39 AM rewolff: (I'm waiting for the with-USB version).
09:53 AM arti_ is now known as arti
10:13 AM paulo_ is now known as Guest62718
10:15 AM lvlinux is now known as ruel
11:22 AM nohit: there's also value lines, most powerful mcus but with smaller memories https://blog.st.com/stm32f7-and-h7-value-line-mcu/
11:24 AM nohit: that's pretty amazing because those can do DSP stuff also
11:26 AM nohit: this is also cool https://blog.st.com/stm32mp1-mpu-stm32mp157a-ev1-stm32mp157c-dk2/
11:26 AM nohit: you can put linux on the A-7 and do real time stuff on M-4
01:28 PM ac_slater: alright guys, I cannot figure this out. On my AVR32 UC3C, the SPI controller is set to have no in master mode RX FIFO by default - I also can zero the bits in the control register and prove it's disabled. Yet, the RX path always buffers
07:07 PM Thrashbarg_ is now known as Thrashbarg
09:00 PM rue_mohr: mitxela, I was just playing with reading fuses latley
09:01 PM rue_mohr: didn't find a good option, but I was failing cause I was trying to use the arduino interface to read the fuses
10:01 PM rue_shop1: --
11:28 PM day_ is now known as day