cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769 EVAL DMA for TIM2 PWM occurs only once, why?

VMoca.1
Associate II

I am trying to set-up a PWM with 20kHz pattern and every time the PWM is over to add a new one.

I am using to start-up the DMA if (HAL_TIM_PWM_Start_DMA(&TimHandle, TIM_CHANNEL_3, SamplingPoints, length) != HAL_OK) function

First time the pulse is sent and in the middle of the transmission, the DMA1_Stream1_IRQHandler() interrupt is coming. What is strange is that when clearing the flags (inside the interrupt) is that first the Half Transmission flags is cleared (HTIF) and in the same call also the Full transmission flag (TCIF).

When calling the second time HAL_TIM_PWM_Start_DMA() I get an error in HAL_DMA_Start_IT () at line  

/* Process locked */

 __HAL_LOCK(hdma);

it breaks the function and it stays like this with HAL_ERROR;.

What am I missing?

2 REPLIES 2
VMoca.1
Associate II

Good config

0690X00000DAZGpQAP.png

Crash config0690X00000DAZFmQAP.png

berendi
Principal

AN4776 General-purpose timer cookbook for STM32 microcontrollers has some example code without HAL, which has a better chance of working.