cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 - ADC DMA - Standard Request Example

IGärt.1
Associate II

Hello

I am looking for an example to get the ADC regular sequence transferred by DMA to memory going.

I use TIM15 to trigger the ADC regular sequence, which has four measurements, every 5 milliseconds. When I activate the EOS IRQ and toggle a GPIO I see that the four conversions are done. So that works fine.

However, if I start the GPDMA to transfer the ADC data to an array it copies the same value to all four array elements. I added another GPIO toggle to the GPDMA transfer complete ISR and see on the scope that the ISR is happening after the third conversion. Also strangely enough, the DMA half transfer complete ISR starts after the first conversion

On the ADC I enabled DMA (CFGR.DMAEN = 1) and set it to circular mode (CFGR.DMACFG = 1)

My GPDMA configuration is 

  • src/dest data width: HalfWord (CTR1.SDW_LOG2 = 1 / CTR1.DDW_LOG2 = 1)
  • src/dest burst length: 1 (CTR1.DBL_1 = 0, CTR1.SBL_1 = 0)
  • src increment: disable (CTR1.DINC = 0)
  • dest increment: enable (CTR1.SINC = 1)
  • BlockHwRequest: SingleBurst  (CTR2.BREQ = 1)
  • transfer event: Block (CTR2.TCEM = 0)
  • transfer mode: Peripheral flow control (CTR2.PFREQ = 1)

I start the GPDMA with the correct source and destination addresses, and with a a data length of 8 (CBR1.BNDT = 😎 which is four conversions with two bytes each.

I tired a lot of other configurations as well, but never get it going correctly.

To get an example from STM32CubeMx I chose GPDMA1 Channel 0 in "Standard Request Mode". However, the generated code creates a Linked-List configuration. I debugged the HAL_ADC_Start_DMA() function and it goes into the linked-list configuration. The example works fine, butI don't want to use the Linked-List configuration.

Does anyone know how to get a linked-list free example? Or has anyone observed similar behavior and was able to solve the issue?

Thanks for your inputs 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Sarra

Thanks for your reply.

I used that article, among others, to generate a standard request mode. I also chose that configuration in CubeMx. However, the generated code goes through the linked-list configuration when I debug HAL_ADC_Start_DMA()

I could resolve the issue though by setting the destination HW request bit CTR2.DREQ = 0

I had it set to 1 by mistake, so the DMA works fine now 🙂

Cheers

Ivo

View solution in original post

2 REPLIES 2
Sarra.S
ST Employee

Hello @IGärt.1

Please refer to this article on how to to configure the GPDMA with Standard Request Mode: How to configure the GPDMA - STMicroelectronics Community

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Sarra

Thanks for your reply.

I used that article, among others, to generate a standard request mode. I also chose that configuration in CubeMx. However, the generated code goes through the linked-list configuration when I debug HAL_ADC_Start_DMA()

I could resolve the issue though by setting the destination HW request bit CTR2.DREQ = 0

I had it set to 1 by mistake, so the DMA works fine now 🙂

Cheers

Ivo