beyondscreen / node-rpi-ws281x-native

native bindings to drive WS2811 (or WS2812) LED-Controllers on a Raspberry Pi
MIT License
224 stars 101 forks source link

Using any control line other than BCM 18 #65

Closed scottstratford closed 6 years ago

scottstratford commented 7 years ago

Has anyone gotten any other interface to work? I am doing this:

   var ws2812 = require('../../node_modules/rpi-ws281x-native/lib/ws281x-native');
   ws2812.init(NUM_LEDS, {gpioPin: 18});

and if I use any value other than 18 (i.e. 10 or 21) as the gpioPin I get this error:

   <snip>/node_modules/rpi-ws281x-native/lib/ws281x-native.js:136
   bindings.init(numLeds, options);
   ^
   Error: init(): initialization failed. sorry – no idea why.
   at Error (native)

I am running on a Raspberry Pi Zero. Pin 18 is basically working but I am getting irregular delays on the write command. I am driving a 60 LED strip and most calls to write take <2ms, but every minute or so a write will take ~600ms to ~1200ms ... I'm only looking to use SPI to see if this problem can be solved.

I am running on Jessie, node 6.10.3.

=======================================================

Opps, sorry, should have read through all of the other issues, one gave me the tip of trying:

{dmaNum: 10} and it seems to have fixed the blocking.

I'd still like to know if anyone else has gotten SPI to work, for when I want to control multiple strips.

usefulthink commented 6 years ago

I'm closing this as this will be resolved with version 1.0 (now finally on the horizon). See #67 for progress on that.

hardillb commented 6 years ago

This still doesn't work with the node-rpi-ws281x-native@next builds

const pixel = 13;
const neopixel = ws281x(1,{gpio: pixel, stripType: 0x00081000});

Throws the following error:

Error: Selected GPIO not possible
    at Error (native)
    at init (/home/pi/N556/node_modules/rpi-ws281x-native/lib/ws281x-native.js:156:12)
    ...

Any idea when we might be able to use pin 13?

usefulthink commented 6 years ago

hm, hard to say. That is an error that is forwarded from the underlying c-library which now supports multiple operating modes (PWM, SPI and PCM) to support as many pins as possible. There is some more information about this in that projects readme.

Maybe the problem is, that PWM1 is only supported for the second channel, not sure if I am reading this correctly right now:

https://github.com/jgarff/rpi_ws281x/blob/d50cc444fa3a12bd8e2332ac5d1dd5e61b338e68/ws2811.c#L651-L658