Re: PWM and code in the main loop
Posted: Sat Mar 15, 2025 5:31 am
well, off topic, I'm thinking that if we'd re-implement the neopixel drivers, 2 possible ways are:
- with the SPI method, use DMA instead. That'd alleviate the need to use systick timers for this purpose.
- with Timers method, this is likely more difficult to implement. Normally, for timers, it is possible for timers to initiate DMA.
This is well known but that it is mainly used to transfer data across parallel gpios (send / receive).
The other way which I'm not sure if it is feasible is to update the timer registers in particular the CCR *and* overflow register using DMA.
Based on the specs for WS2812B
https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf
it'd seemed that the period is constant and the difference is mainly the duty cycle period to differentiate '1' and '0' symbols.
This would seemed to say that it may be possible to update just CCR using DMA to drive neopixels.
But that I've not tried it and I'm not sure if it's possible.
using hardware timers is a rather interesting proposition as if hardware timers can be used to drive neopixels, it may resolve the timing gitter issues as they are clock / crystal driven.
- with the SPI method, use DMA instead. That'd alleviate the need to use systick timers for this purpose.
- with Timers method, this is likely more difficult to implement. Normally, for timers, it is possible for timers to initiate DMA.
This is well known but that it is mainly used to transfer data across parallel gpios (send / receive).
The other way which I'm not sure if it is feasible is to update the timer registers in particular the CCR *and* overflow register using DMA.
Based on the specs for WS2812B
https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf
it'd seemed that the period is constant and the difference is mainly the duty cycle period to differentiate '1' and '0' symbols.
This would seemed to say that it may be possible to update just CCR using DMA to drive neopixels.
But that I've not tried it and I'm not sure if it's possible.
using hardware timers is a rather interesting proposition as if hardware timers can be used to drive neopixels, it may resolve the timing gitter issues as they are clock / crystal driven.