2018-06-26 06:21 AM
I am using 6 STM32F302CB as slaves & a STM32F407ZE as master. My issue is that after about 1-2 hours the first slave stops receiving data and then more and more slaves stops receiving, but the controller is still running.
Its not a specific slave that stops first.
I have tried to DeInit SPI & DMA and then I have inited them again, but this didn' t solve my problem.
The only solution I found was to reset the slave over NVIC_SystemReset() after the timeout.
Has anybody an idea how to solve my issue? I would be nice to find & solve the issue, instead of finding a way to work around the problem.
If additional information is needed feel free to ask!
Regards,
Tobias
#spi #dma2018-06-26 06:45 AM
are all the processors on one board ?
here is a starter list
1. good grounding between slaves, avoiding ground loops
2. better noise suppression on the power supplys.
3. not USB powered.
never use DeInit, if you think you need it then you haven't found the problem.
4. desperate moves, ESD protection on all spi pins
5. use a MIC803 reset monitor on every processor
6. maybe its you ... maybe your code has unmapped conditions, just a thought...
2018-06-26 07:56 AM
Unfortunately, 'stops receiving data' tells us next to nothing. Much more information is needed to allow us to actually help.
2018-06-26 08:13 AM
Ideally observe the lines on a scope to look at signal slew rates and quality.
Adjust the SPEED values for the SPI GPIOs, change the clock phase settings (few combinations here to try).
You also need to give enough pause for the slaves to process their received message (it depends on how and when they process the incoming data, be a length byte or NSS going high as EXTI event).
Sometime you may have higher priority interrupts in slaves which makes SPI out of sync. Make longer delays on master time where the slaves are processing their interrupts. Use DMA whenever possible.
What SPI mode is it? 4 or 3 wires, what clock frequency and phase/polarity? TI mode? Daisy chain or multi-drop?
2018-06-28 07:34 AM
its a motherboard with 8 expander card slots, there is a circuit on the motherboard which generates the power supply for it & the expander slots, so its not USB powered
also I can't imagine grounding problems -> each pcb has an own ground plane
to DeInit was only a test, but it didn't help to restart the DMA unit
i guess that the issue is the code, i thought eventually someone had the same issue and could help me
2018-06-28 07:39 AM
the dma is configured to receive 8 databytes and then it generates an interrupt (HAL_SPI_TxRxCpltCallback), where i check if the ssel is active, then received data is handled
my problem is that the interrupt isn't generated anymore after the mentioned 1-2 hours...
2018-06-28 08:30 AM
i will check the communication with a scope...
SPI & DMA have the highest priority in my code
i am using 4-wire SPI with 1,3125 MHz clk with cpha 0 & cpol 0 in mutli-drop structure without TI mode...