Skip to content

ports/rp2/mphalport.h: Fix mp_hal_pin_xyz() for pin>=32 #16191

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

Merged
merged 2 commits into from
Jan 11, 2025
Merged

ports/rp2/mphalport.h: Fix mp_hal_pin_xyz() for pin>=32 #16191

merged 2 commits into from
Jan 11, 2025

Conversation

sfe-SparkFro
Copy link
Contributor

@sfe-SparkFro sfe-SparkFro commented Nov 8, 2024

Summary

Fixes #16190

Testing

Tested on a board with an RP2350B, now NeoPixels on pins >=32 work.

Trade-offs and Alternatives

This uses gpio_put(), though gpio_set_mask64() might also work. The latter didn't work right away for me, and I did not bother testing further since gpio_put() worked fine, so it's possible I just did something wrong with gpio_set_mask64().

Copy link

github-actions bot commented Nov 8, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:   +16 +0.002% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@sfe-SparkFro
Copy link
Contributor Author

Turns out the reason the 64-bit versions didn't work is because you need to explicitly typecast to a uint64_t. Updated to use mask functions since they should be faster than gpio_put()

@Gadgetoid
Copy link
Contributor

Gadgetoid commented Nov 25, 2024

This slipped under my radar since we use our own PIO-based WS281X driver, but we might have a good excuse to give this a try and get some feedback here.

Edit: Hmm so far no dice. Tested before these patches and our PIO WS281X driver works, NeoPixel did not. Tested with these patches applied, still not working. I'm going to have to grab my scope.

Edit: sigh too many feature branches, too much chaos!

Edit: Can confirm these fixes work for me, driving seven WS281X pixels from pin 33.

Fixes issue #16190.

Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
@dpgeorge dpgeorge merged commit 7964a43 into micropython:master Jan 11, 2025
8 checks passed
@sfe-SparkFro sfe-SparkFro deleted the fix_16190 branch January 13, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NeoPixel does not work on RP2350B with GPIO pin >=32
3 participants