cancel
Showing results for 
Search instead for 
Did you mean: 

inverted pwm output not working

Asha1
Visitor

Subject: STM32G070RB – Need PWM Output on PD 4 (TIM1_CH3N) for WS2812 LED Strip Interface – Hardware Locked

Description:

We are working with a custom-designed board based on the STM32G070RB, running at a system clock of 64  MHz. The hardware is already manufactured and cannot be modified.

In this design, we have routed the output pin for PWM to PD 4 which corresponds to TIM1 Channel 3 N (CH 3 N) — an inverted/complementary output channel.

Our requirement is to interface a WS2812 LED strip, which needs precise PWM (typically using one of the timers with DMA or tight timing). However, we now realize that PD 4 is a complementary output (CH 3 N), and normal PWM output through this pin is not functioning as needed.

Since we cannot change the hardware, we are looking for guidance on:

Is it possible to generate a usable PWM signal on PD 4 (TIM1_CH3N)?

Can this inverted/complementary channel be configured to act as a standard PWM output?

Is there a known workaround or recommended method for using CHxN pins (like CH3N) for devices like WS2812?

Any help, reference examples, or insights into configuring TIM1_CH3N for such use cases would be greatly appreciated.

Thank you for your support.

1 REPLY 1
TDK
Super User

Use HAL_TIMEx_PWMN_Start to start PWM on a complementary channel. If you are not using channel 3, then you can use channel 3N instead in an equivalent manner. Shouldn't need to change pins. CubeMX will do the configuration for you.

Here's a PWM example:

STM32CubeG0/Projects/NUCLEO-G070RB/Examples/TIM/TIM_PWMOutput/Src/main.c at 300e5f4ff686ea91a0b5658654f0abaebc4359ab · STMicroelectronics/STM32CubeG0

If you're still having issues, consider showing the code you're having trouble with.

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