Skip to main content
Associate III
October 24, 2023
Solved

Large DMA buffer fails for ADC conversion - STM32H7(23ZG)

  • October 24, 2023
  • 9 replies
  • 2789 views

Hi, I have a problem. I want to store 262144 (256KB) bytes of data in a buffer from the integrated ADC on STM32H723ZG. However it fails when the buffer is too large. I started at an buffer size of 4096 elements (uint8_t) and doubled until 65536 where it failed (only output is 0, 0, 0...). I am using a circular buffer with continuous conversion on the DMA.

Can anybody help me to find out what the cause of this problem is, and how to fix it? The total capacity on the RAM_D1 is 320KB, so 256KB should be enough... 

Thanks for all the help I get! 

This topic has been closed for replies.
Best answer by AScha.3

maybe you found the size of transfer limit...

AScha3_0-1698146980184.png

in rm , DMA , registers , ..

9 replies

AScha.3
AScha.3Best answer
Super User
October 24, 2023

maybe you found the size of transfer limit...

AScha3_0-1698146980184.png

in rm , DMA , registers , ..

If you feel a post has answered your question, please click on " Best Answer ".
elsoAuthor
Associate III
October 24, 2023

So how would you solve it? Is it a way to go around it or change the limit?

AScha.3
Super User
October 24, 2023

the limit is fix, "number of data" is a 16 b register.

you just want 8 bit from adc ? so set source to byte,

but if you using the cache and set destination to word (32 b), you could get 64k x4 = 256k byte.

AScha3_0-1698149402612.png

(if it count the destination /32b tranfers - i dont know , just try it ! )

if not - try the MDMA .

If you feel a post has answered your question, please click on " Best Answer ".
Pavel A.
October 24, 2023

>until 65536 where it failed

This is an interesting number :)  Some ST drivers indeed have 16-bit typed counters/sizes. Read the sources. Don't ignore compiler warnings. 

elsoAuthor
Associate III
October 24, 2023

Works at 65535, but everything above makes the DMA transfer fail (>=65536). Seems like the limit is at 16-bit :) Will have to find a workaround!

Maybe waiting for the:

HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc)

and

HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

To do memory transfers of half the buffer at the time to another buffer.