2024-11-25 04:54 AM
Hello,
I'm facing a very strange issue with timer PWM in DMA mode.
I use the PWM channel to send step pulses to a stepping motor in order to free the mcu while the motor is moving, rather than using time consuming delays.
The issue raises when I change the motor speed by changing the PWM frequency.
Changing the PWM frequency breaks the DMA.
What I mean by breaks the DMA is that when I call the start function
if (HAL_TIM_PWM_Start_DMA(THIS->timer, THIS->channel, THIS->burst_buffer, THIS->steps_burst_size) == HAL_OK)
{
osMessageQueueGet(THIS->sync, &_token, 0L, osWaitForever);
}
I always get HAL_OK, but the pulse finished callback is never called.
I change the PWM frequency in a rather rogue way, by writing a new value to the ARR register.
I'm sure that the issue is related to the frequency change, if I comment out the lines changing the frequency, all works well.
To check wether errors are are trigerred or not, I setup a HAL_TIM_ErrorCallback, but it never gets called.
2024-11-25 06:46 AM
Hello @zeboss49,
Are you enabling the preload when updating to the ARR register?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.