STM32H7 | Portenta H7 Data missing during DMA transfer (ADC to Memory)

1.1k Views Asked by At

I'm currently working on STM32H747XI (Portenta H7). I'am programming the ADC1 with the DMA1 to get 16bits data at 1Msps.

I'm sorry, I can't share my entire code but I will therefore try to describe my configuration as precisely as possible.

I'm using the ADC1 trigged by a 1MHz timer. The ADC is working in continus mode with the DMA circular and double buffer mode. I tryed direct mode and burst with a full FIFO. I have no DMA error interrupe and no ADC overrun.

My peripheral are running but I'm stuck front of two issues. First issue, I'am doing buffer of 8192 uint16_t and I send it on the USB CDC with the arduino function USBserial.Write(buf,len). In this case, USB transfer going right but I have some missing data in my buffer. The DMA increments memory but doesn't write. So I don't have missing sample but the value is false (it belongs to the old buffer).

You can see the data plot below : transfer with buffer of 8192 samples

If I double the buffer size, this issue is fixed but another comes. The USB VPC transfer fail if the data buffer is longer than 16384 byte. Some data are cut. I tried to solve this with differents sending and delays but it doesn't work. I still have the same kind of cut.

Here the data plot of the same script with a longer buffer : transfer withe buffer of 16384 sample (32768 byte)

Thank you for your help. I remain available.

1

There are 1 best solutions below

4
On

For a fast check try to disable data cache. You're probably not managing cache correctly or you haven't disable caching in the memory space where you're using DMA. Peripherals are not aware of cache so you must manage it manually. You have also to align buffers to cache lines in this case.

Refer to AN4839