-   Open ReVolt: open source DC motor controller (
-   -   Problem using bootloader (

z_power 01-18-2017 10:33 AM

Problem using bootloader
(this is for 500A DC controller)

I'd like to tinker a little with firmware code so working bootloader would be much more comfortable to use in car than ISP; found Adam's instructions regarding RTD Explorer in this post but it doesn't work for me...

Microcontroller is ATMega168P, it's programmed with "coug-unified-16k.hex" code v.1.9; fuses are set according to instructions in "bootload168" directory (E: 0xF8, H: 0xDC, L: 0xF7). Controller works fine in car and communicates with RTDexplorer on Windows XP.

After clicking and confirming "Load firmware" controller seems to enter bootloader (error LED no longer blinks due to throttle not connected) but there's no further action - no messages like "avr_write_flash_block" etc. and after that I need to kill "avrboot.exe" process to regain access to COM port. What's interesting is that controller needs to have it's power cycled to start again; pulling low ISP reset pin doesn't bring back "blinking LED state" (maybe false result of initial CRC check causes stop in while(1) loop?)

It looks to me like problem occurs during avrboot execution, do you have any ideas how to get it to work?

MPaulHolmes 01-26-2017 06:50 PM

I never used the bootloader successfully. Well, maybe a really really long time ago, but I never understood how it worked. Fran Sabolich wrote it I think, and I just loaded the bootloader/controller code with a programmer.

z_power 02-11-2017 03:33 PM

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?

z_power 02-12-2017 01:47 PM

OK, watchdog issue solved - I managed to compile bootloader with few lines added. Controller wakes up properly after restart but no success in firmware upgrade function - avrboot just hangs :(

All times are GMT -4. The time now is 03:26 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright