2025-08-20 10:53 AM - last edited on 2025-08-20 11:28 AM by TDK
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.
2025-08-20 11:28 AM
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:
If you're still having issues, consider showing the code you're having trouble with.