This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

driving WS2812B (neopixels) with I2S without SCK/LRCK

Hi, I'm trying do drive WS2812B LEDs (aka neopixels) with the I2S peripheral, using method similar to this https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/driving-ws2812b-leds-using-i2s-on-the-nordic-nrf52

I got the right signal out of SDOUT pin, provided I also configure LRCK and SCK pins (which I don't need). When I set either or both of the LRCK/SCK pins to 0xffffffff, no signal comes out of the SDOUT pin.

Is it possible to leave the SCK/LRCK disconnected and have the I2S still operate?

The code is below. It also has detects the end of transmission correctly (first TXPTRUPD triggers after the hardware picks up the pointer, so we set the MAXCNT to one more byte and wait for that one to be picked up). 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "NRF52SPI.h"
#include "hal/nrf_i2s.h"
#include "codal-core/inc/types/Event.h"
#include "ErrorNo.h"
#include "CodalFiber.h"
namespace codal
{
// based on https://electronut.in/nrf52-i2s-ws2812/
static int numIrq;
extern "C" void I2S_IRQHandler()
{
if (NRF_I2S->EVENTS_TXPTRUPD != 0)
{
NRF_I2S->EVENTS_TXPTRUPD = 0;
volatile uint32_t dummy = NRF_I2S->EVENTS_TXPTRUPD;
if (numIrq == 0)
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Parents
  • thank you!  I had working code on the nrf52832 that required the SCK pin, but not the LRCK pin.  The same code running on the nRF52840 does require the LRCK pin.  I couldn't figure out why it wasn't working until I ran into this post.

  • It is possible to use PWM peripheral with double-buffer and generate the PWM data on the fly from neopixel data. I never got around to implement that though... I saw some examples, but they pre-compute neopixel data, which very memory in-efficient.

  • yes, i've seen some examples but not a plain reusable library. The i2s solution was the easiest one to implement for me.

Reply Children
No Data