Skip to main content
zhiyongwoo
Associate III
May 14, 2020
Question

Multiple read from Peripheral to Memory using DMA

  • May 14, 2020
  • 3 replies
  • 1788 views

Dear Experts,

Can I configure the DMA2 to do say 3 repeats read on GPIOx_IDR by a single DMA request?

I do not want to have array of bytes instead I would like to write into a single variable and overriding it with the latest value.

I have set the MINC bit to 0 in the specific DMA2 register. So the variable always being written with the latest value.

 HAL_DMA_Start( htim1.hdma[TIM_DMA_ID_CC2], (uint32_t)&GPIB_D0_GPIO_Port->IDR, (uint32_t)GPIOE_IDR_buff_, 3);

Will the above API perform 3 reads on the GPIOx_IDR?

Please advice.

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
May 14, 2020

Which STM32? And what is the trigger source?

You should be able to do that with the DMAMUX on the newer STM32 models.

Forget about Cube/HAL and read the DMA/DMAMUX chapters in RM.

JW

zhiyongwoo
Associate III
May 14, 2020

I am using 32F429ZI. Does it has the module you mention?

waclawek.jan
Super User
May 15, 2020

No.

Tesla DeLorean
Guru
May 14, 2020

Only one transfer per trigger

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
zhiyongwoo
Associate III
May 14, 2020

I was inspired by how the DMA for UART Tx is and the ADC. They can do multiple transfer per request.

BTW, I am using TIM Chn2 to detect a falling edge, this generates a DMA request.

Tesla DeLorean
Guru
May 15, 2020

Yes, those have a demand driven trigger, the TIM trigger is slightly different. I think it has a register that will write multiple registers, not delved into it.

The TIM do multiple one-shot operations, which might be usable, you'd have to work through the docs, and test things.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
berendi
Principal
May 14, 2020

It is possible to set up the timer to send 3 successive DMA requests, but what is the purpose of this? How would the result be different from reading the IDR just once?