-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
RP2040 Can't use both PIO channels at the same time #854
Comments
It should have worked. But things do change in the board and library that may affect it. I will try to take a look soon.
and
The |
The second this is where I started trying to figure out the issue. It also didn't work there. I think maybe it doesn't work because I haven't tried the first one yet but since I managed to fix it for myself locally by patching the lib to have two |
Did you do something like this?
|
Yes, that's almost exactly how I did it. |
Describe the bug
When creating NeoPixelBus instances for both PIO 0 and PIO 1 (for example to have up to 8 instances instead of 4) and the first
Begin()
call is made on an instance using PIO 0, all instances using PIO 0 will work fine but the other ones (using PIO 1) will never be able to send data to the LED and get stuck blocking forever on the secondShow()
call.To Reproduce
Begin()
on the instances using PIO 0 first.ClearTo(RgbwColor(random(256))
.Show(
) methods on all instances.Show(
) of any instance using PIO 1.Expected behavior
Show()
calls to all instances (using both PIO 0 and 1) should update the LEDs and not get stuck blocking forever.Development environment (please complete the following information):
Minimal Sketch that reproduced the problem:
Root cause
In
src/internal/methods/Rp2040/NeoRp2040PioMonoProgram.h
classNeoRp2040PioMonoProgram
it loads the program into the instruction memory of the first PIO (PIO 0) when making the first call toadd()
and stores the offset. But when you want to use the other PIO (PIO 1) it won't load the program into the memory of PIO 1 since thes_loadedOffset
it already set. Instead it will try using the offset of the program stored in PIO 0 instruction memory which will obviously cause the state machine in PIO 1 to not run how it should and the data to never finish sending.(very inconvenient) workaround
It is still possible to get it to work like this if you try running it with PIO 0 initializing first then flashing it (dont turn off power; using a debug probe) with a new program that initializes PIO 1 first. Since the program stays on the memory of PIO 0 everything will work... until you try turning the power off and on again.
The text was updated successfully, but these errors were encountered: