Hello,
I have been working on a custom PCB powered by the nRF52832 microcontroller. It has custom bootloader, softdevice s132 and application code present on board, since we need the custom bootloader to perform OTA updates to the controller. We have the watchdog timer setup in the application code to handle error cases in the application code. Though the watchdog does get triggered and the device gets reset, the NRF_POWER->RESETREAS register had the softreset flag high instead of watchdog reset flag in the application code. When I check the NRF_POWER->RESETREAS register in the bootloader and the watchdog reset flag was set there. I think this was due to the fact that the microcontroller enters the bootloader first after watchdog reset and the watchdog flag gets cleared there when the NVIC_systemreset() is called at the end of the bootloader.
I have a few questions: 1. What's the best way to send the watchdog flag to the application code from the bootloader, since I would be needing to report the watchdog reset incident over the BLE to an external mobile app and softreset is unavoidable in bootloader (My understanding is that Softreset is required to enter the application code). Would processing the flag information in bootloader and passing over application code through RAM or flash using linker scripts? Is there an easier way other than this?
2. Is there any documentation on what the NVIC_systemreset() resets during the softreset? Would RAM be reset during this process?
3.I was able to find this thread which explains how to implement variable exchange b/w bootloader and application code: RAM variables exchange between bootloader and application - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com). Here in this thread, under Ketil's answer, he mentioned about using Flash API to write to memory allocated region through the custom struct. Where would we be able to find this Flash API? And how would we be able to modify the API to write to memory allocated region?
Any help is appreciated! Thank you so much!