STM32F107 Software Reset breaks Interrupt functionality
I have FreeRTOS set up on an STM32F107 performing several tasks of different priority in "parallell".
There is one task of IDLE priority that blinks an LED and one task of Normal priority that receives communication over CAN (triggered by external interrupts). There are also some tasks that reads values off the ADC and uses DMA.
There is also a bootloader in place that can receive new firmware via CAN.
When the MCU is powered it starts in the bootloader, and a custom CAN message kicks it to the application, and everything works fine. The application can receive messages from CAN, blink the LED and execute calculations just fine.
Another custom message can bring it from the application back to the bootloader (via a call to NVIC_SystemReset()), which works. But it is when attempting to bring the MCU back to the application (after NVIC reset) that things start to behave weirdly:
Sometimes, roughly ~60% of the time, the MCU seems to not enable interrupts. The LED blinks just fine (indicating the RTOS is still running its most low-priority task) but the application is not responding to CAN messages. Which to me indicates that interrupts have not been set up correctly.
I have tried putting LED indications on hardware fault handlers and failure to initialize CAN without any success, so I am not sure what the MCU is doing.
I also tried disabling IRQ and all system clocks before calling the NVIC reset without any luck.
Do you have any ideas on how to troubleshoot this further?
Is there any recommended procedure to perform before calling NVIC_SystemReset?
Thanks in advance!
BR,
David