cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance Required with STM32F303VCT6 SPI Communication and Retaining Last State on Restart

Dheeraj129
Associate

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:

  • The STM32F303VCT6 microcontroller occasionally stops sending data over the SPI interface. It appears to hang, and the only way to recover from this state is to restart the controller.
  • This issue occurs very rarely and does not follow a predictable pattern. After a restart, the controller resumes normal operation and communication with the Rock PI S.
  • The microcontroller is interfaced with various ADCs, DACs, and digital input/output devices.

Request for Assistance:

  1. Troubleshooting the SPI Communication Issue:
  • 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.
  1. Retaining the Last State on Restart:
  • 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.
  • Could you advise on the best practices or techniques to achieve this with the STM32F303VCT6? Specifically, we are interested in retaining the DAC state across power cycles or resets.


    Note: We have already replaced the hardware at this one site, but it keeps happening after a while.  
1 REPLY 1
TDK
Guru

> 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.

If you feel a post has answered your question, please click "Accept as Solution".