AnsweredAssumed Answered

Desync of DMA by flash programming ?

Question asked by Mr_M_from_G on Jun 30, 2017

Hello,

 

I have a strange behaviour in a bit complicated setup:

This is my setup

a number of concatenated timers create a periodical burst of 4 pulses, 70 µsec appart, bursts are 2.5msec apart. These pulses trigger a DMA transfer from an array SPI_send_array to SPI1->DR. The in turn incoming word on SPI1 triggers a DMA transfer from SPI1->DR to an array SPI_rcv_array. Another one of the concatenated timers then triggers an interrupt in which the data of SPI_rcv_array is processed and stored to a larger array. Both DMAs work circular that means SPI_send_array and SPI_rcv_array are only 4 words large and start again from index 0 with each burst of pulses. With this I can take in data without any software involved and therefore with low jitter (it takes data from an ADC)

So far this work perfect and I never had any trouble with it.

But now there is a situation that needs to store one word into flash. I know that this stop CPU for about 1 msec. After that SPI_send_array and SPI_rcv_array are desynchronized that means index for SPI_send_array is one further than index for SPI_rcv_array. This situation is just as stable as the correct one was before.

I don't understand why that is, I thought it all runs in peripheral HW and I can't see how to debug it, if there is something to debug at all.

 

Anyone here with experience on this?

 

Thanks a lot

 

Martin

Outcomes