I’ve come across a very frustrating intermittent fault in my program and cannot seem to solve the issue.
I’m using an STM32 NUCLEO L073RZ microcontroller to receive GPS data over UART (using a serial interrupt) and then send it over LoRa (using a timer interrupt).
The weird issue that I am having: The program occasionally gets stuck in the Timer interrupt (just loops through it, without even entering main) seemingly when the GPS gets a fix. This happens around one time in every 5.
I suspect that it could be something to do with the UART interrupt taking slightly longer when getting a fix because of the longer NMEA sentence and the interaction with the timer interrupt causes an issue, but do not know for sure, or how to fix this!
The GPS code works perfectly fine on its own. As soon as I introduce the timer to send over LoRa the issue occurs. The code can also run fine without getting a GPS fix, but as soon as the extra parsing occurs, the UART interrupt stops firing and the program gets stuck in the timer interrupt loop. I know that the GPS is not the issue because I’ve connected it to an Arduino after the UART hang-up and it still transmits valid data over UART.