2025-06-25 12:42 AM - edited 2025-06-25 12:42 AM
Hi everyone,
I'm working with the STM32F030 and recently ran into a hardware limitation that I unfortunately discovered only after designing my custom PCB:
I'm using PA4 (TIM14_CH1) to control an LED driver (like SM16126 or WS2812), but just realized that TIM14 has no DMA support on this MCU.
So now I'm trying to find a workaround to still achieve DMA-controlled PWM output on PA4 without redesigning the PCB.
Since TIM14 can still generate PWM on PA4, I thought of using another timer (e.g. TIM2) as a DMA trigger source to regularly write new values into TIM14->CCR1, changing the PWM duty cycle every 1.25 µs (or whatever timing is required).
So the setup would be:
TIM14 is configured for standard PWM output on PA4
TIM2 runs at e.g. 800 kHz and triggers a DMA transfer every 1.25 µs
DMA writes the next CCR1 value from a pwmBuffer[] to TIM14->CCR1
→ This way, the output waveform on PA4 changes duty-cycle at each step, encoding the bits I need (T0H/T1H), while the CPU stays free, and PA4 acts like a proper DMA-driven PWM output.
Is this approach valid and robust?
Can this method be considered functionally equivalent to using a real "TIMx_CHy with DMA" setup?
Are there known pitfalls, race conditions, or unexpected side effects when using this indirect method?
Any advice or validation from those who’ve done something similar would be greatly appreciated!
Thanks a lot
2025-06-25 6:26 AM
Sounds like it'll work to me. DMA looks to have access there. The chip doesn't care where you write, as long as DMA can access.
2025-06-25 11:30 AM
I have set it up meanwhile and everything works fine :)