Skip to main content
VMoca.1
Associate II
February 14, 2020
Question

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

  • February 14, 2020
  • 2 replies
  • 863 views

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?

This topic has been closed for replies.

2 replies

VMoca.1
VMoca.1Author
Associate II
February 14, 2020

Good config

0690X00000DAZGpQAP.png

Crash config0690X00000DAZFmQAP.png

berendi
Principal
February 14, 2020

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