question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for more than one strip

See original GitHub issue

When trying to control two WS2812 strips with AdaFruit_NeoPixel on two separate PWM GPIOs (Board.D13 and Board.D18) I get the following RuntimeError:

Error in atexit._run_exitfuncs: Traceback (most recent call last): File “na.py”, line 1287, in exit_handler led_strip.shutdown() File “na.py”, line 891, in shutdown self.color_wipe(LED.color(0, 0, 0)) File “na.py”, line 934, in color_wipe self.pixels2.show() File “/usr/local/lib/python3.5/dist-packages/neopixel.py”, line 230, in show neopixel_write(self.pin, self.buf) File “/usr/local/lib/python3.5/dist-packages/neopixel_write.py”, line 24, in neopixel_write return _neopixel.neopixel_write(gpio, buf) File “/usr/local/lib/python3.5/dist-packages/adafruit_blinka/microcontroller/bcm283x/neopixel.py”, line 70, in neopixel_write raise RuntimeError(“Raspberry Pi neopixel support is for one strip only!”) RuntimeError: Raspberry Pi neopixel support is for one strip only! swig/python detected a memory leak of type ‘ws2811_t *’, no destructor found.

Here is how I initialize:

pixels1 = neopixel.NeoPixel(
    board.D18, LED.LED_COUNT, brightness=1, auto_write=False, pixel_order=neopixel.GRB)
pixels2 = neopixel.NeoPixel(
    board.D13, LED.LED_COUNT, brightness=1, auto_write=False, pixel_order=neopixel.GRB)

RuntimeErrors are thrown whenever I call this:

pixels1.fill(color)
pixels1.show()
pixels2.fill(color)
pixels2.show()

Is there a reason only one strip is supported?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
makermelissacommented, Dec 24, 2020

Ok after trying a number of different strategies, I’m concluding that it really isn’t possible. Here’s some background of what I tried: I was running into issues with NeoPixels on 2 different pins responding to the same changes. This is because there are 2 PWM channels on the Raspberry Pi that share a number of pins and both of the ones I was using are on PWM0.

The specific parameter options for this dtoverlay can be found with the following command:

dtoverlay -h pwm-2chan

So I enabled the second PWM channel using the pwm-2chan dtoverlay by adding the following line to my /boot/config.txt

dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4

The pin functionality can be found on page 102 of the data sheet at https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf.

I confirmed they were set in PWM output with the following command:

raspi-gpio get 12,13

and got the following output:

GPIO 12: level=0 fsel=4 alt=0 func=PWM0_0 pull=DOWN
GPIO 13: level=0 fsel=4 alt=0 func=PWM0_1 pull=DOWN

I ran my test script and got the following error:

RuntimeError: ws2811_init failed with code -11 (Selected GPIO not possible)
Segmentation fault

I did notice that after running the script, the raspi-gpio command now outputs the following:

GPIO 12: level=0 fsel=4 alt=0 func=PWM0_0 pull=NONE
GPIO 13: level=0 fsel=1 func=OUTPUT pull=NONE

This tells me that the rpi_ws281x library is handling changing the pin muxing already and the dtoverlay was probably not necessary. However, it just refuses to cooperate and the issue lies outside of Blinka. Also, the benefit of 1 additional strand is probably not worth it since strands can be chained together already, so I’m going to close this issue.

0reactions
makermelissacommented, Dec 24, 2020

There seems to be a pretty big bug with the rpi_ws281x library that will write the data to both GPIOs once they have been initialized as separate strips. This happened when using multiple instances and adapting the multistrand example above. I think strategy 2 (reinitializing between each write) might be the way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-strip Support - WLED Project
Multi strip support. Starting in WLED 0.12.0, you are able to use multiple LED outputs from one ESP board! Pins and LED numbers...
Read more >
Multiple accounts | Stripe Documentation
Multiple accounts. Learn how to create and manage multiple Stripe accounts. You can create additional Stripe accounts associated with your email address.
Read more >
Wix Editor: Adding and Setting Up Columns on Your Strip
Adding more columns to a strip · Click the strip (with at least two columns) in the Editor. · Click Manage Columns. ·...
Read more >
Apply plug-in effects to audio regions in Logic Pro
Select one or more audio regions in the Tracks area or the Audio Track ... You can choose complete channel strip settings, or...
Read more >
Installing LED Tape – how to wire your large LED projects
One of the questions we get asked most often is, “how do I install more than 5m of LED tape?” LED strip lighting....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found