Skip to main content
JDooe
Associate
November 29, 2018
Question

[STM32F0] How to generate PWM with DMA

  • November 29, 2018
  • 4 replies
  • 2335 views

Hello,

I'm working with CubeMX to configure my MCU (STM32F030CCT6TR) for my school project. I want to generate a PWM with DMA but I don't know how to do it even after doing researches.

Currently I configure my DMA as attached.

Can you help me ?

Best regards,

John

This topic has been closed for replies.

4 replies

Khouloud GARSI
Technical Moderator
November 29, 2018

Hi @JDooe​ ,

I'd highly recommend you to refer to TIM example under the STM32CubeF0 V1.9.0 firmware package. 

It's found under the path below:

STM32Cube_FW_F0_V1.9.0\Projects\STM32F030R8-Nucleo\Examples\TIM\TIM_DMA

The example titled "TIM_DMA" provides a description of how to use DMA with TIMER Update request

to transfer Data from memory to TIMER Capture Compare Register.  The objective of the example is to configure TIM1 channel 3 to generate a complementary PWM signal.

You may take this example as a reference to correctly configure your peripheral.

Khouloud.

JDooe
JDooeAuthor
Associate
November 29, 2018

Hi @Khouloud GARSI​ ,

Thank you for your help. I will look this up.

Best regards,

John

Khouloud GARSI
Technical Moderator
November 29, 2018

You're always welcome!

If you have any further questions, do not hesitate to post them on our STM32MCUs Forum ;)

Best regards,

Khouloud.

JDooe
JDooeAuthor
Associate
December 10, 2018

Hello,

I found examples that use TIM DMA but the target wasn't the same as mine. So I tried to understand the code of the main.c and adapt it.

I found the problem. It was from my TIM configuration I didn't initialize the good Channel that I use for my PWM.

Now I can generate a PWM but when I want to change the value of my buffer that i use to generate the PWM, the PWM doesn't change.

Can you help me ? Do you have any idea how to debug the code of the main.c, attached?

Best regards,

John

$AK
Associate III
February 15, 2021

Hello @JDooe​ 

I too face the same issue with different mcu, did you find any solutions for the issue stated.

If so kindly reply with it.

Regards,

AK

JDooe
JDooeAuthor
Associate
January 21, 2019

Up