I see this approach on controlling sequences of the WS2812B RGB LEDs.
The clever part is usuing the DMA to push the pattern out to the strip of LEDs without CPU overhead. Leaving the CPU to make pretty patterns.
http://blog.gitmi.com/interfacing-ws281 ... -update-3/
I wonder if we can use our DMA, SPI this way ?
(FYI SPI at 500kHz)
Original SPI approach is from Elia (on STM32..):
- http://eliaselectronics.com/driving-a-w ... -an-stm32/
The DMA originally by OctoWS2811 Paul Stoffregen:
- https://github.com/PaulStoffregen/OctoWS2811
DMA, SPI and WS2812B
Re: DMA, SPI and WS2812B
This approach: http://forum.micropython.org/viewtopic. ... S2812#p899 uses SPI.
The SPI code doesn't look like it has DMA support yet =, but when it does, then we'll be able to allow the CPU to do things while the DMA is occurring.
The SPI code doesn't look like it has DMA support yet =, but when it does, then we'll be able to allow the CPU to do things while the DMA is occurring.
Re: DMA, SPI and WS2812B
SPI now supports DMA for send, recv and send_recv. These functions wait for the DMA transfer to finish before returning. Perhaps there needs to be an option to return straight away?
Re: DMA, SPI and WS2812B
Having an option to return right away seems sensible.
You'd need a way to determine when the transfer is done (by polling).
It would also be good to be able to register an IRQ callback that runs when the DMA completes.
You'd need a way to determine when the transfer is done (by polling).
It would also be good to be able to register an IRQ callback that runs when the DMA completes.
Re: DMA, SPI and WS2812B
All these things are possible. I think the DMA even includes an irq for transfer half complete.
Could use select module to determine when transfer is complete (but that could be overkill for such a simple check).
I consider exposing DMA as an object, since it has so many options, but I think it might be better to have the DMA managed fully by the "OS" and assign fixed channels for each peripheral. Then expose DMA functionality only by keyword arguments to the relevant methods.
Could use select module to determine when transfer is complete (but that could be overkill for such a simple check).
I consider exposing DMA as an object, since it has so many options, but I think it might be better to have the DMA managed fully by the "OS" and assign fixed channels for each peripheral. Then expose DMA functionality only by keyword arguments to the relevant methods.
Re: DMA, SPI and WS2812B
I don't think that we need to expose DMA directly.
I think that just being able to register a SPI transfer complete callback would be fine.
Tying it in with select might make sense but probably only if the SPI worked with stream (or whatever select uses).
I think that just being able to register a SPI transfer complete callback would be fine.
Tying it in with select might make sense but probably only if the SPI worked with stream (or whatever select uses).