Severe Reset issues with freeRTOS
This was a ticket I opened this year regarding a fatal flaw in FREE RTOS which I didn't get a final answer or proper solution. Even so the team that I've been working with manage to get a workaround that for now has been shown to be very effective, but we need a permanent solution. Since if a watchdog is running and many programmers don't know about this issue, the device might stall or brick until a full power cycle is done or until it's reprogrammed again if an upgrade (Firmware over the air for example) was in progress.
Here's the post, and for the ST team here's the case number 00153229
"Greetings,
Currently we are developing the firmware of medical device using this microcontroller (STM32L4S9AI) and we are currently having the following issue, 50% of the times we reset the core, the device doesn't boot, we found that it's getting stalled on the pendingSV related functions.
Since the hardware is from a client and there's a non disclosure agreement, we are limited to the information we can provide.
But here's the current information about the configuration that I can provide without prejudice:
- internal flash is divided in 3 sections, Pre-bootloader, Bootloader and Main Firmware
- FreeRTOS is being used (CMSIS v2)
- Low Power timer is configured for low power modes (stop mode 2)
This problem started once we start using the stop modes and other hardware features, but we realised that it was just a coincidence, and further testing shows that if the boot is successful, the next time we reset the watch it will stall once "xPortPendSVHandler" is called. The first two firmwares run perfectly but once the transition to the third firmware occurs, it stalls.
We manage to make a first work around that actually works, but we are afraid that might be a temporary solution as the program grows.
One fix is, for the standby and reboot we de-initialize all hardware and make a reset (works 100% of the times) other is clear the ram memory in the pre-bootloader, but its not working properly all the time.
Thanks.
Best regards,
André Pereira"
Here's one of my answers with an important detail:
"Greetigns Mr. ########,
In a powerup cycle everything works fine because all the memory is being written from scratch, but when resetting, part of the ram memory for some reason persists causing hardfault when it calls pending_SV because it has a register that is active/true/enabled it for some reason during the boot. We also suspect there's also a ghost process running that triggers the Hardfault."
