cancel
Showing results for 
Search instead for 
Did you mean: 

To Convert pwm to gpio

CKANG.2
Associate

I am currently designing a program using ST32G070 chip.

As a question, I would like to create a program that will change what I was using as a PWM without using Cube Mx into a digital signal LOW or HIGH signal.

I'd like to know how to change it.

2 REPLIES 2

So you have a pin on which you have a PWM output from a timer, and you want to stop the PWM and set the pin to low or high?

The simplest way is to change the respective GPIO_MODER setting from AF to Out, and then by setting the respective but in GPIO_ODR (through GPIO_BSRR) you set it to low or high. Read the GPIO chapter in Reference Manual.

jW

TDK
Guru

Or if you want to use HAL:

  1. Call HAL_GPIO_Init to initialize as an output.
  2. Call HAL_GPIO_WritePin to set as low or high.

If you feel a post has answered your question, please click "Accept as Solution".