Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Multi_WS2811 mbed MMA8451Q
Fork of WS2811 by
You are viewing an older revision! See the latest version
Homepage
After being frustrated by the SPI system's performance, I ended up using an approach inspired by Paul Stoffregen's OctoWS2811. This uses 3 of the 4 DMA channels triggered by the TPM0 timer PWM and overflow events.
This design will allow for up to 16 strings of at least 40 (limited by memory) WS2811/WS2812 LEDs to be driven on a single port.
Adding more strings takes the same time to DMA, because the bits are output in parallel.
The way I have my code set up, I can use up to 8 pins on PORTD. However, changing the defines at the top of WS2811.cpp will change the selected port.
Alternatively, you could use another port to get more strings. Watch out for pin mux conflicts, though.
Here are your choices:
- PORTE: 15 total: PTE0-PTE5, PTE20-PTE25, PTE29-PTE31
- PORTD: 8 total: PTD0-PTD7
- PORTC: 16 total: PTC0-PTC13, PTC16-17
- PORTB: 16 total: PTB0-PTB11, PTB16-19
- PORTA: 15 total: PTA0-PTA5, PTA12-PTA20
Here is how the DMA channels are interleaved:
