Pages: [1]   Go Down
Author Topic: Start bootloader from within program?  (Read 392 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 81
everywhen
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I would like to be able to update firmware without having the physical unit. I was wondering if there is a way to call the bootloader, or reset the microcontroller, from within my code? This way, the PC software could trigger a reset, then launch the command-line upload program with the new ROM.

Thanks
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried to accomplish a reset using the watchdog timer. This will not work. You will end up in an infinite reset loop as the bootloader doesn't tickle the watchdog and it stays enabled when it goes off.

In software the best you can do is jump to the reset vector (the instruction at 0x0000) after initializing all the important registers (at least turn off all the outputs and set all the digitalWrite()s to 0 to kill the pull up resistors). I had the code somewhere, but I think I ripped it out since I didn't trust my ability to find and initialize all the registers.

If you have an extra pin, you could wire it to the reset pin and pull it low to make a real reset.
Logged

Pages: [1]   Go Up
Jump to: