AnsweredAssumed Answered

IAP: jump to new program from within ISR

Question asked by tarca.matthew on May 14, 2015

Just finished writing a custom boot loader (in application programming) that works over UART. I received new program data through a terminal program, and then after writing the appropriate data of the new program to flash, I jumped to the new code. The thing is, I realized that I was doing this within the UART interrupt routine that received the final program data byte. The new program executed, but things that normally work via interrupts such as GPIO toggling I had setup for timing were not working. Timers setup to work as PWM sources were working, however. Conclusion: the jump to the new program worked (kind of), but there was a problem with interrupts. Exiting the UART interrupt after setting a "download complete" flag in the boot loader code and THEN jumping to the new program from main() fixed the problem.

So, I solved the problem, but I am looking for wisdom that can explain what was happening here. Any input would be much appreciated.