#avr Logs

Apr 14 2022

#avr Calendar

12:41 AM WormFood: demo-serial-2313.c:53:3: error: 'UCSR0A' undeclared (first use in this function); did you mean 'UCSRA'? <-- avr-gcc 11.2.0 gives improved error messages, with suggestions. (Maybe it did that in previous versions, but not in the version I was last using)
12:50 AM Phantom: it did iirc
12:50 AM WormFood: baltazar, I try to avoid the arduino libraries. No professional software uses that stuff. That is for people that don't know how to program, and don't know MCUs. I imagine most users stay there, and never upgrade.
12:50 AM WormFood: Phantom, what version started giving suggestions?
12:50 AM Phantom: dunnot, but I'm pretty sure I saw that when I compiled 2 years ago
03:38 AM baltazaar is now known as baltazar
04:28 AM baltazar: WormFood: yeah, I thought so. apparently by default they have some code that starts a watchdog timer if you open it on 1200 baud and do something with the dts line? I guess I'll just give up on software resets and just stick to pulsing the reset pin for programming
04:31 AM WormFood: whatever works ;)
04:40 AM WormFood: Does anyone know where I can get a definitive list of AVR registers/fuse names/settings?
05:17 AM LeoNerd: The partinfo XMLfiles
05:17 AM LeoNerd: I have to head AFK now, but I have a bunch of code for reading them here -- https://metacpan.org/pod/Device::AVR::Info
05:18 AM LeoNerd: I use them to generate the partinfo files I store about the UPDI-based chips, in https://metacpan.org/release/PEVANS/Device-AVR-UPDI-0.10/source/share
05:18 AM LeoNerd: Hopefully that's enough to give you a foothold on working it out
08:33 AM specing_ is now known as specing
11:44 AM WormFood: The Atmel/AVR Studio package is nearly a gig in size. Do I need to download a huge waste of space, just to get the most current xml files?
12:10 PM LeoNerd: No, the XML files are available as their own .zip files
12:10 PM LeoNerd: lemme find a link
12:12 PM LeoNerd: https://packs.download.microchip.com/
12:12 PM WormFood: I remember looking for this same info a number of years ago, but it wasn't easy
12:12 PM LeoNerd: You want the "Microchip ATtiny Series Device Support" or similar
12:12 PM LeoNerd: ATmega, AVR-Dx, .. oooh what's an Ex now?
12:17 PM WormFood: Thanks LeoNerd. That should be exactly what I'm looking for
01:29 PM holgersson: Hi, I've got a ATTiny85 here on a digispark USB board that I can't flash to.
01:29 PM holgersson: I've using a cross-compiled gcc11 with the following Makefile: https://paste.xinu.at/NQmPZ/
01:29 PM holgersson: When I try to flash with micronucleus I get the message "The reset vector of the user program does not contain a branch instruction, therefore the bootloader can not be inserted. Please rearrange your code."
01:29 PM holgersson: Could someone point me to a tutorial or manpage describing how to rearrange my code - or solving the problem in another way?
01:45 PM josuah: holgersson: according to that message, the reset vector, sometimes a function in assembly named "__init()", is not really looking good
01:46 PM josuah: I assume they check that it "branches" to something to make sure it jumps to main()
01:46 PM josuah: so if there is no branching to main() in your reset vector (entry point of execution), maybe something went wrong with initialisation code
01:46 PM josuah: or maybe the detection is wrong
01:46 PM josuah: one way to check is looking at:
01:47 PM josuah: - the binary itself, with avr-objdump -d $file.elf for instance
01:47 PM josuah: - the linker script, to check what is put at address 0x0 (maybe an AVR jump table? not sure for ATtinies)
01:48 PM josuah: - the code that provides that jump table (often some crt0.S or if compiled crt0.o)
01:48 PM josuah: - the map file that tells what was linked where
01:48 PM josuah: I'd probably give a look at the map file first
01:50 PM josuah: feel free to question anything I said: I've not worked with ATtiny, but guessed from ATmegas328P
01:53 PM cehteh: attiny85 has no dedicated bootloader section, things are a bit hacky / different to atmegas
01:54 PM cehteh: reading the micronucleus docs should point these things out i think
01:55 PM josuah: cehteh: thanks, I was much doubting here... One more thing for me to learn then! :)
01:56 PM josuah: holgersson: sorry, I was wrong above... see cehteh comment
02:09 PM nohit: usually you jump from reset vector to _start, do some initialization(set stack pointer, zero out .bss, copy .data to ram from flash etc.) and then jump to main()
02:10 PM nohit: but avr users never see this because crt0 is provided as object file
03:07 PM holgersson: (Sorry for my delay, was on train and later offline there.)
03:07 PM holgersson: I guess I should read the micronucleus docs again - and I've got another idea:
03:07 PM holgersson: I'll set up a pre-built avr-gcc from debian or similar and test that one to rule out it's an issue with my too new gcc.
05:33 PM WormFood: holgersson, your ATtiny85 is running at 64Mhz?
07:26 PM WormFood: One of you guys, I think it was rue_mohr, who suggested (more than once), that I should write an AVR fuse calculator. I'm not going to do that...however, I may write something, that would include the calculation of fuses. I'm seeking comments and suggestions on that topic. What would a fuse calculator do, to make it useful for you? (I already have my own ideas, I just want to see if I'm missing something)
07:34 PM rue_mohr: oh just a mod on the baud rate for timers
07:34 PM rue_mohr: not sure on how to target it, sometimes when I do it, its freq, sometimes its interval
07:35 PM cehteh: calculators are plenty on the internet, some tables what fuses are compatible with what features may be useful
07:35 PM cehteh: kind of osc, what speed/voltage grades, bootloader, applicaiton usable flash,
07:36 PM cehteh: plus recovery hints
07:36 PM rue_mohr: with the current availablity of any microcontroller, I'v started making controllers out of rocks and sticks
07:36 PM rue_mohr: I think I figured out a great way to deal with large roms using sewing pins with the tips ground off
07:37 PM rue_mohr: I'm also trying to hack hard drive controllers
07:37 PM cehteh: note there are a lot corner cases like brownout limits supply voltage, higher speed needs higher voltage, EEPROM programming at low voltage is unreliable etc
07:38 PM cehteh: as well as hacking some tricks, couple a frew into some osc pin instead running a crystal
07:39 PM cehteh: and highest possible programming speeds for some given fuses/osc may be useful too
07:39 PM cehteh: still that saied i dont really think i would need either of that
07:42 PM cehteh: ah and OSCCAL values vs speed are somewhat different between the AVR's in range and there is sometimes a break point in the middle where speeds overlap
08:17 PM Phantom: WormFood: there is some fuse calculator out there, with some warning about how non-standard they are. If you plan to do that, you will need to find someone that already compiled the fuses, or dig through hundreds of datasheets
08:26 PM WormFood: Phantom, don't worry about that. That's the easy part.
08:28 PM WormFood: The hard part, is organizing such a massive amount of data
08:33 PM Phantom: xml, and lots of visit to the confessional to get pardonned for all the swearing you did while coding it :D
08:33 PM specing_ is now known as specing
08:34 PM WormFood: I confess to *nothing*
09:10 PM WormFood: hhhmmm...it seems there are no xml from Microchip on the classic AT90Sxxxx series
09:12 PM WormFood: Some of that info they give will be very time consuming to compile for the AT90S series.
09:36 PM cehteh: WormFood: toss all the knowledge into a prolog program :D