cancel
Showing results for 
Search instead for 
Did you mean: 

DMA adds to the time delay of counters

RSy.1
Associate III

Hello guys I just want to ask why adding a callback is causing additional time delay to counters. In my case I created a periodic pulse using the PeriodElapsedCallback which is in interrupt mode. I toggle the output every 300ms and this is working fine. Then I created an additional DMA for the PWM using the PulseFinishedCallback. Then when I checked my counter the 300ms somehow increased to 315ms. What is the reason why the delay increased by 15ms? Is this additional overhead time processing due to the PulseFinishedCallback.? However this is too long.

4 REPLIES 4

What is "additional DMA for the PWM using the PulseFinishedCallback" ?

JW

This is a function I created for the PWM.

HAL_TIM_PWM_Start_DMA(&htim2, TIM_CHANNEL_1, PWM, 1);  

.

.

.

void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)

{

.

.

.

}

I don't use and don't understand Cube/HAL.

Do those functions somehow modify the relevant timer registers (PSC, ARR)? Read out and check timer registers content.

Do you stop/restart the timer (or use it in one-pulse mode)? Then increased processing time in ISR might matter. 15ms sounds quite excessive - which STM32 are you using and what's the system clock?

JW

RSy.1
Associate III

It's STM32F103C8 running at 48MHz. Not used in one pulse mode and it is free running. Let me check the start/stop. Thank you for the hint.