-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document use two PWM-channels #30
Comments
There are two PWM-Channels on the raspberry-pi that can work independently – so the answer is yes, you can drive two LED-Strips with this library. If you look at main.c, there is the initialization for both channels. Both channels work synchronized, so you always need to pass a structure containing both channels to the api-functions (defined in ws2811.h). Unfortunately I don't know the correct settings to be used for the second channel (which DMA and GPIO-Pin to use). |
The pic and table of IO here has the details for the B+ and A+: http://www.raspberry-projects.com/pi/pi-hardware/raspberry-pi-model-b-plus/model-b-plus-io-pins It's a little tough to read but PWM0 is on GPIO18 and PWM1 is on GPIO13 and GPIO19 (on the far right bottom row in the pic). Use channel = 1 and pin = 13 or 19 to access the second PWM channel (the first channel 0 is only on pin = 18). Also you can chain multiple strips together and drive them all off just one PWM channel. In the past there was a limit of ~490 pixels total based on kernel DMA memory limits. I think this might have been increased a bit, but there's still a practical limit where updating pixels bits at 800khz (the fixed speed for neopixels) will get slower and slower the more pixels are in a strip. For example 1000 pixels would only be able to update at most ~33 FPS, and 2000 pixels would drop in half to ~16 FPS, etc. |
Wow guys, thanks for the quick and extensive reply! If I find the time later today I'll fire a pull req. to put this in the README so other users can profit. |
Would it be possible to run multiple chains by using addition GPIO pins to control multiplexing of the serial data to multiple strips either at:
|
The first version would indeed be possible, if you just add some AND-Gates between the GPIO-Pin and the LED-Strips. Take one of these for example: https://www.nxp.com/documents/data_sheet/74HC_HCT08.pdf If you take one of these and connect the PWM0 Output from GPIO18 to both Inputs 1A and 2A and two LED-Strips to outputs 1Y and 2Y, you can control which of the two LED-Strips will receive the signal using the Inputs 1B and 2B. Like this:
The two signal for 1B and 2B can be generated any way you like, so you could use any two GPIO-Pins for this. You just need to do the "channel-select" before calling Oh, and by the way, in this case you can leave away the logic-level shifter, as the AND-Gates will already do that for you. |
Yeah, I get you. The only advantage is if there are times when you want multiple strips to be driven with the same data and others when you don't - or if you have different length strips (different rooms perhaps) and if you could open the individual strips' gates just at the right time... <aside>I am starting to use @joan2937 's pigpio library and was wondering whether it might be possible to combine the functionality of both - but as that library use the Unlicence to be put in the Public Domain the author of that (or anyone else) could not use this and retain that licence - a composite work would have to adopt the BSD-2 line one that is used here...</aside> |
I am having trouble with this still, trying to run GPIO 13 on PMW channel 1 and GPIO 18 on PMW channel 0. The LEDs only seem to work on GPIO 18 only. The other channels result in wierd flickering. If I code it to use pin 18 only and pin 13 is connected both LEDs start flashing even though I coded it to only go to pin 18. Thought I would share and see if anyone else is still having the same issues. |
I also experience the flickering with that setup. Any idea why this is happening? |
This is open two years later - can anybody comment on whether or not it's possible to use this to (reliably) drive multiple strips via multiple GPIO pins at once? I know mostly we're discussing driving on GPIO 13 and 18, but I'm curious if it is possible to do 4x strips at once, using GPIO 13 and 18, and then MOSI on pin 19 and PCM on pin 40. Has anybody tried this? What is and isn't working in 2020(1)? |
I logged #446 due to odd results with PWM, not sure if it is related to this issue. But I wanted to add that in my limited tests, I can use GPIO 12 + channel 0 (although with odd results - wrong colors, flickering), but cannot use GPIO 13 + channel 1 (no LEDs light up ever). Using GPIO 10 (SPI) worked consistently and correctly, but I too would like a PWM solution if one is possible. I cannot use pins 18-21 due to using a sound card that requires those, which admittedly may also be causing problems with PWM I guess. |
Audio uses PWM. You cannot drive led strips and use analog audio at the same time. There is 2 ways : audio over internet or external USB sound-card. |
Document the comments below, as replied of the question issue below, as part of the README.
Was:
Hey Jeremy, thanks for this great effort! I've been looking to control NeoPixels straight from a Pi for some time now.
However, from quickly reading the docs and the code I cannot seem to extract whether or not multiple strings are supported and if so: how. It would be totally awesome if your library could allow something like Fadecandy without the additional Teensy.
The text was updated successfully, but these errors were encountered: