2022-03-21 06:00 PM
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);
Solved! Go to Solution.
2022-03-21 06:53 PM
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.
2022-03-21 06:53 PM
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.
2022-03-21 06:57 PM
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
2022-03-22 01:43 AM
Thank you for your advise. I can make it by using HAL_DMA_Start() in HAL_TIM_IC_CaptureCallback().
2022-03-22 01:47 AM
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().