View Single Post
Old 02-11-2017, 03:33 PM   #3 (permalink)
EcoModding Lurker
Join Date: Dec 2011
Location: Poland
Posts: 66
Thanks: 12
Thanked 27 Times in 22 Posts
I think I've found it; it is about watchdog behaviour after reset (watchdog is used to restart microcontroller with "restart" uart command). It is mentioned in avr-libc documentation:
Note that for newer devices (ATmega88 and newer, effectively any AVR that has the option to also generate interrupts), the watchdog timer remains active even after a system reset (except a power-on condition), using the fastest prescaler value (approximately 15 ms). It is therefore required to turn off the watchdog early during program startup
So after "software reset", either by direct command or firmware upgrade process watchdog timer is left at 15 ms until power-off because there's no wdt_disable nor wdt_reset in bootloader code.

This is where I need your help - I tried to add few lines for disabling wdt, but I can't successfully compile into working hex. I can't do it even with unchanged code; here's how I try it:
- installed latest (20100110) WinAVR on Win XP laptop
- copied bootload.c, misc.asm, autocrc.h, genautocrc and Makefile into C:\000
- run "make"
- joined output file bootload.hex with couc-crc-16k.hex (yes, i know how to join hex files in Notepad)
- checked fuses and uploaded joint hex into processor

...and nothing - while it should start blinking led

Do you have any suggestions how to debug this thingy? I think I'll start with switching led in bootloader code to see where it's stuck. Any better ideas?
  Reply With Quote