cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set the address for DMA

SShir.2
Associate II

I try to use DMA to transport data from GPIO input regester (GPIOx_IDR) to some other buffer memory. DMA reguest is created by timer with input capture mode so I turn on DMA by HAL_TIM_IC_Start_DMA(). This function doesn't have a arugument for source address of data so I tried to set source data address like DMA1_Chanel5->CPAR = &GPIOB->IDR;

But it didn't work. Are there any solution for this?

my code is down below

uint32_t buf[10];

DMA1_Channel5->CPAR = (uint32_t)tx_buf;

 HAL_TIM_IC_Start_DMA(&htim2,TIM_CHANNEL_1,buf,10);

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

HAL_TIM_IC_Start_DMA transfers data from TIMx->CCRx to memory. If you want something else, you'll need to create your own similar function.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

HAL_TIM_IC_Start_DMA transfers data from TIMx->CCRx to memory. If you want something else, you'll need to create your own similar function.

If you feel a post has answered your question, please click "Accept as Solution".

What STM32? There's several hundred models

You typical use HAL_DMA functions to set up the addresses, and transfer counts

Typically GPIO to Memory needs a Memory to Memory DMA, via 16-bit wide transfers.

This may dictate the DMA1/DMA2 and related TIM you have to use.For example the F2/F4 would need to use DMA2, and a TIM on APB2

For timing transfer you typically use the DMA Unit/Channel dictated by the TIM Update source

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you for your advise. I can make it by using HAL_DMA_Start() in HAL_TIM_IC_CaptureCallback().​

Thank you for your advise.

I use stm32L476.

I could make it by setting DMA with memory to memory and use HAL_DMA_Start() in HAL_TIM_IC_CaptureCallback().