2024-08-05 09:53 PM
Our main hardware controllers use the STM32F303VCT6 microcontroller, which connects via SPI to a Rock PI S. Two daughter boards that use STM32F303 microcontrollers and SPI communication can be connected to the main master board. Although the system operates smoothly most of the time, we would appreciate your help with an intermittent problem we have with one of the daughter boards.
One controller has a middle daughter board that stops delivering data while the main board and the second board, connected by the first daughter board, only send data over SPI constantly.
Problem Description:
Request for Assistance:
2024-08-06 05:26 AM
> We would appreciate any insights or recommendations you can provide to help us diagnose and resolve the issue where the STM32F303VCT6 stops sending data over SPI.
It's probably a code bug. To get insight, attach a debugger and examine the state of the software when the issue occurs. You can attach a debugger to a powered chip without resetting it if you modify the debug configuration settings.
Output useful information about the state of the systems to a debug stream that you can look at for post-mortem analysis.
> We would like to implement a method to retain the last state of the microcontroller, particularly the DAC outputs, upon restart. This would ensure that the system does not lose critical state information when a restart occurs.
This isn't a super viable approach. After reset, all peripherals are reset. There is no way to change this
If you had prior notice of the reset, you could save register values to flash memory, but restoring the entire chip state isn't going to be easy or straightforward. More likely to introduce bugs than to solve anything.
You could save a limited amount of info, say the DAC information, by writing it to flash.
If power is not lost, the SRAM will still contain data. If you hijack the startup routines, it's possible for you to use this data before it's re-initialized.
Realistically, the best solution would be to find and fix the code bug causing the issue in the first place.