Skip to content

examples/rp2/pio_uart_rx: Fix error running example. #17678

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 1 commit into from
Jul 17, 2025

Conversation

AJMansfield
Copy link
Contributor

@AJMansfield AJMansfield commented Jul 14, 2025

Running the unmodified pio_uart_rx example by uploading the file and importing it doesn't succeed, and instead emits a NameError at line 26.

Discovered while using this and other examples to help verify #16851.

With this fix, and the specified jumper between GPIO4 and GPIO3, this example runs successfully on both my PicoW and my Pico2.

Copy link

codecov bot commented Jul 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (0b698b8) to head (554f114).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17678   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files         171      171           
  Lines       22208    22208           
=======================================
  Hits        21863    21863           
  Misses        345      345           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

(The existing example did work because _boot.py imports rp2 into the global namespace and doesn't delete it, but we shouldn't rely on that.)

@AJMansfield
Copy link
Contributor Author

AJMansfield commented Jul 16, 2025

The existing example did work because _boot.py imports rp2 into the global namespace and doesn't delete it, but we shouldn't rely on that.

Ah, right! In my case I was running the examples like:

mpremote \
    cp examples/rp2/pio_uart_rx.py :/pio_uart_rx.py \
    exec "import pio_uart_rx"

But running as mpremote run examples/rp2/pio_uart_rx.py should work since that's basically equivalent to pasting the contents of the file into the REPL (i.e. inheriting the main namespace which inherits the boot namespace).

Running the unmodified `pio_uart_rx.py` example by uploading the file and
importing it doesn't succeed, and instead emits a NameError at line 26.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
@dpgeorge dpgeorge force-pushed the pio_uart_rx_example_fix branch from f64c341 to 554f114 Compare July 17, 2025 04:34
@dpgeorge dpgeorge merged commit 554f114 into micropython:master Jul 17, 2025
24 checks passed
@AJMansfield AJMansfield deleted the pio_uart_rx_example_fix branch July 17, 2025 13:46
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy