-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
NeoPixel does not work on RP2350B with GPIO pin >=32 #16190
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
Comments
Looks like mp_hal_pin_low() and mp_hal_pin_high() in rp2/mphalport.h have to be fixed to use gpio_set_mask64() and gpio_clr_mask64() instead of the 32bit versions. Someone with a RP2350B could implement and test it. It may have an impact on Neopixel timing. |
Turns out the reason the 64-bit versions didn't work is because you need to explicitly typecast to a |
I will compare it to the previous state tomorrow. I still have the old test data from rp2040. The difference should be small, like a few clock cycles per output phase. |
Actually, would it even matter if it takes longer? The bitstream implementation (which the NeoPixel driver uses) just waits until it's time to toggle the pin state: micropython/ports/rp2/machine_bitstream.c Lines 83 to 93 in 5dfbd43
So as long as setting the pin high/low doesn't take longer than the time between pulses (shortest is 400ns), I don't think it matters if this change results in a couple extra clock cycles. |
Probably it will not matter. Especially not for neopixel, which has quite relaxed timing requirements. |
For comparison the timing for RP2350, RISCV. The 150Mhz figures are good, the ones for 125MHz and 250Mhz are worse. They would need a larger compensation value. The value for 250 Mhz is surprising. Usually the timing got better at higher frequencies. |
PR updated with your suggested timings! |
… RP2350 See micropython#16190 (comment) Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
… RP2350 See micropython#16190 (comment) Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
… RP2350 See micropython#16190 (comment) Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
… RP2350 See micropython#16190 (comment) Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Port, board and/or hardware
rp2 port with RP2350B
MicroPython version
v1.24.0-preview.461.gb8227a3f7.dirty
Reproduction
Expected behaviour
A NeoPixel connected to
pin
should illuminate.Observed behaviour
A NeoPixel connected to
pin
only illuminates ifpin
is <32. Ifpin
is >=32, the NeoPixel does not illuminate.Additional Information
The root problem appears to be here:
micropython/ports/rp2/mphalport.h
Lines 184 to 190 in 5dfbd43
gpio_set_mask()
requires a 32-bit value, so the shifted bit gets truncated when using a pin >= 32. There is agpio_set_mask64()
, however for some reason it didn't work when I tried it (I didn't dig into it). However changing togpio_put()
works fine on my end.Code of Conduct
Yes, I agree
The text was updated successfully, but these errors were encountered: