Main Content

RP2040 with PIO and DMA to address WS2812B LEDs

I love the WS2812B (aka SK6812) addressable LEDs: they are inexpensive and available in different packages. I have used them in different projects, including the MetaClockClock one. I used the NXP Kinetis for these projects, but because they are not available any more, for a new project we had to choose a new microcontroller, with the Raspberry Pi Pico RP2040 as the winner.

In that project, the MCU needs to drive a total of 1024 SK6812 RGB LEDs. To keep the refresh rate reasonable, the LEDs are organized in 8 stripes with 128 LEDs each. The Kinetis K22 or K64 with DMA can easily produce the needed 800 kHz protocol using DMA, see Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 1: Hardware.

I have used the LPC804 for a similar thing using the PLU, but that is only for one single channel, see Adding RGBW Wings and Enclosure to a Debug Probe. But that was for single-lane only.

The Raspberry Pi RP2040 MCU is available and inexpensive (~$1). It has a dual core Cortex-M0+ @120 MHz with 264 KByte of internal RAM. It is not the most powerful MCU on the market, but has an excellent tool and software ecosystem, making it easy for students to use in many projects. It has a wireless option (WiFi, Bluetooth and BLE) which is ‘compatible’ with the Pico board, and the Pico board costs less than $5.

An interesting feature of the RP2040 MCU is the PIO: programmable I/O ‘co-processors’ which can be used to implement custom protocols, for example the 800 kHz bit-stream needed to address the WS2812B/SK6812B LEDs.”

Link to article