2018-10-03 04:07 PM
Hello,
I use STM32H743ZI two SPIs with DMA to collect data. The data are OK when only one SPI with DMA is activated. However, when I use two SPIs with DMA to collect data simultaneously, the data collected are not correct.
The DMA setup:Codes to collect data using SPI with DMA:I use SPIs with DMA to collect a triangular signal (16 bit) at ~600KSPS, and save and transfer the data to data[]. If I only use SPI2 with DMA, the collection data[] is,The collection is good.
If I only use SPI3 with DMA, the collection data[] is,The collection is good.
However, if I use both SPI2 with DMA and SPI3 with DMA to collect the signal simultaneously, the collection data[] is,
The collections from both SPI2 and SPI3 are distorted.
2018-10-03 07:25 PM
what is the SPI slave ?
there are 2 slaves on 1 SPI bus ?
how do you account for the nSS pins ? .. there should be two nSS pins
as far as I know, in the older ST processors the automatic nSS functionality didn't work.
certainly not with DMA. maybe it is resolved on the H7.
anyhow, nSS pins, how do you address that ?
2018-10-03 11:45 PM
Not doing HAL, but looks like two different SPI units, with different DMA channels.
The HAL/Cube code, I think, is quite pathetic in handling concurrency.
I suppose one channel blocks out handling of the receive data for the second channel long enough that the next data overwrite the current one.
2018-10-03 11:56 PM
> I suppose one channel blocks out handling of the receive data for the second channel l
That isn't very feasible unless the SPIs run at extreme rates, and even then I'm not quite sure this could happen with two SPI/DMAs only.
Can't see more through the haze in my crystall ball.
JW
2018-10-04 12:32 AM
> That isn't very feasible unless the SPIs run at extreme rates, and even then I'm not quite sure this could happen with two SPI/DMAs only.
Not much overlap required for occasional data corruption. Or perhaps two external devices triggered at the same time.
[OP] > I use STM32H743ZI two SPIs with DMA to collect data.
I would have used one SPI interface, and manually managed NSS signals.
> Can't see more through the haze in my crystall ball.
I very much agree.