2021-01-05 10:44 PM
We have configured TIM2 Channel 1 to capture rising edge on PA0 pin.
We have enabled DMA1 Stream5 to read data on Port D and copy to local array.
The callback function for DMA1 is not triggered.
Please let us know, if we are missing any configuration.
Note: We are using STM32CubeIDE version 1.5.1 for our project.
Regards,
Rajesh K.
2021-01-05 11:31 PM
Try using DMA2 and a TIM on APB2
2021-01-05 11:48 PM
HI Tesla,
We have tried with TIM8 using DMA2 Stream4.
Still no progress.
Regards,
Rajesh K.
2021-01-05 11:51 PM
What do you mean by "no progress"?
Read out and check/post content of TIM and DMA (and perhaps GPIO) registers' content.
JW
2021-01-06 12:34 AM
Hi JW,
We have initialized timer and registered callback for DMA with below calls.
HAL_TIM_Base_Start_IT(&htim8);
HAL_TIM_IC_Start_IT(&htim8, TIM_CHANNEL_3);
HAL_DMA_RegisterCallback(&hdma_tim8_ch3, HAL_DMA_XFER_CPLT_CB_ID, Transfer_Complete);
HAL_DMA_Start_IT(&hdma_tim8_ch3, GPIOD->IDR, (uint32_t)DMA_Data_Ptr, 1);
We have initiated DMA transfer using below call in input capture callback function
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
Input_Capture++;
}
The DMA callback function is not invoked. No data received in *DMA_Data_Ptr.
static void Transfer_Complete(DMA_HandleTypeDef *DmaHandle)
{
printf("/n/rDMA Transfer Complete . . .");
}
Regards,
Rajesh K.
2021-01-06 01:20 AM
Hi Rajesh,
I don't use Cube.
> Input_Capture++;
How does that initiate DMA transfer?
Read out and check/post content of TIM and DMA (and perhaps GPIO) registers' content.
JW
2021-01-06 01:30 AM
HI JW,
DMA transfer is initiated by below call at initialization.
HAL_DMA_Start_IT(&hdma_tim8_ch3, GPIOD->IDR, (uint32_t)DMA_Data_Ptr, 1);
DMA data is processed in main() function.
main ()
{
.
.
.
if (Input_Capture)
printf("DMA data : %d",DMA_Data_Ptr);
}
DMA transfer is initiated after input captured using TIM8 Channel3. The transferred data is stored in DMA_Data_Ptr.
In main() function DMA_Data_Ptr data is sent to serial port.
Regards,
Rajesh K.
2021-01-06 04:47 AM
You'll need the address of the IDR for starters, and might need the read to be 32-bit wide. If transfers don't occur check for error status on the DMA side.
2021-01-06 04:06 PM
> address of the IDR
i.e. &GPIOD->IDR (maybe suitably cast, if the functions asks for it).
Nice catch.
Similarly with DMA_Data_Ptr, as it doesn't appear to be an array.
JW
2021-01-08 02:34 AM
HI JW,
We have initialized TIM8 Channel 3 in STM32Cube IDE. Please find the captued intialization below.
DMA transfer is initiated in Timer callback function as below.
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM8)
{
Status = HAL_DMA_Start_IT(&hdma_tim8_ch3, (uint32_t)&GPIOD->IDR, (uint32_t)&DMA_Data[Data_Cnt++], 1);
Timer_Cnt = 0;
}
}
While debugging Status of DMA transfer is showing as DMA busy. What could be the reasons for DMA busy status?
Can you suggest the initialization sequence to use DMA
Regards,
Rajesh K.