Skip to content

zephyr-cp: add the MacroPad RP2040 - #11652

Merged
mikeysklar merged 7 commits into
adafruit:mainfrom
dhalbert:zephyr-cp-macropad-rp2040
Oct 23, 2026
Merged

mikeysklar merged 7 commits into
adafruit:mainfrom
dhalbert:zephyr-cp-macropad-rp2040

Conversation

@dhalbert

@dhalbert dhalbert commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Board definition and testing by Claude. This note by @dhalbert.

Add adafruit_macropad_rp2040_zephyr board.

  • Pin names same as the ports/raspberrypi board.
  • Partition layout is from Add MacroPad RP2040 layout adaboot#11, same as Feather RP2040
  • The upstream Zephyr board definition added fixed keys (gpio-keys) and encoder (gpio-qdec) nodes. These were disabled so keypad and rotaryio can claim their pins.
  • Added CONFIG_DISPLAY=y to turn on the onboard display board.DISPLAY.
  • The upstream Zephyr board definition puts the Zephyr console on uart1, which uses the STEMMA QT pins. The console is removed by default, as on the nRF52840 boards, and i2c0 is enabled as board.I2C() and board.STEMMA_I2C. Thanks @mikeysklar for the patch.
  • A CONSOLE=1 or DEBUG=1 build puts the Zephyr console back on the STEMMA QT pins (TX on SDA, RX on SCL), without board.I2C() or board.STEMMA_I2C.

Other:

Testing

On a MacroPad:

  • CIRCUITPY works and is the right size
  • on_next_reset(RunMode.UF2) resets into RPI-RP2.
  • board.DISPLAY shows the REPL and displays a simple displayio test pattern.
  • board.STEMMA_I2C() finds an MSA301 at 0x26, and is the same bus as board.I2C().
  • With CONSOLE=1, the Zephyr boot banner and log output appear on an FTDI cable connected to the STEMMA QT pins.

These tests were done with #11649 (not yet merged) temporarily merged in:

  • rotaryio gives one count per detent.
  • keypad.Keys on all 12 keys and on the encoder switch works as expected.

dhalbert and others added 3 commits October 22, 2026 13:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also brings in adaboot adafruit#10: RP2 boards get boot-mode retention from a
per-SoC overlay instead of their layout dtsi. The settings are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin names come from the raspberrypi port board. The partition layout,
the same as the Feather RP2040, comes from adaboot.

Changes from the upstream board:
- The keys (gpio-keys) and encoder (gpio-qdec) nodes are disabled so
  keypad and rotaryio can claim their pins.
- CONFIG_DISPLAY turns on the SH1106 OLED as board.DISPLAY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from mikeysklar October 22, 2026 18:31
docs/shared_bindings_matrix.py needs it for every zephyr-cp board.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikeysklar

mikeysklar commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Tested on a MacroPad with #11649 merged in.

Keypad on all 12 keys, encoder switch and rotary all work.

I2C on STEMMA QT and USB serial both don't work as submitted.

The upstream dts puts the Zephyr console on uart1 at GPIO20/21.

Doing what the ItsyBitsy does fixes both: board.I2C() then finds a QT gamepad at 0x49, same as 10.3.1.

Could you use this instead?

--- a/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.conf
+++ b/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.conf
@@ -5,3 +5,7 @@ CONFIG_IOBROKER_PACKAGE_RP2040_QFN56=y
 
 # Enable the SH1106 OLED via the Zephyr display subsystem
 CONFIG_DISPLAY=y
+
+# No Zephyr UART console (see board.overlay), so SCL/SDA are free for I2C.
+CONFIG_UART_CONSOLE=n
+CONFIG_LOG_BACKEND_UART=n
--- a/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.overlay
+++ b/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.overlay
@@ -12,3 +12,19 @@
 		status = "disabled";
 	};
 };
+
+/* No Zephyr console, so SCL/SDA (GPIO21/20) are free for I2C0. */
+/ {
+	chosen {
+		/delete-property/ zephyr,console;
+		/delete-property/ zephyr,shell-uart;
+	};
+};
+
+&uart1 {
+	status = "disabled";
+};
+
+&i2c0 {
+	status = "okay";
+};

Also:

  • board.STEMMA_I2C is missing.
  • NeoPixels don't work on this board yet: neopixel_write on zephyr-cp is only implemented for nRF. RP2 support should be added using PIO, as a follow-up PR.

dhalbert and others added 2 commits October 22, 2026 18:22
Upstream puts the Zephyr console on uart1, on GPIO20/21, which are the
STEMMA QT SDA/SCL pins. Remove the console, as the nRF52840 boards do,
and enable i2c0. The zephyr_i2c label makes it board.STEMMA_I2C as well
as board.I2C.

Co-Authored-By: Mikey Sklar <mikeysklar@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A CONSOLE=1 or DEBUG=1 build puts the Zephyr console back on uart1, on
the STEMMA QT pins (TX on SDA/GPIO20, RX on SCL/GPIO21), and disables
i2c0, so board.I2C() and board.STEMMA_I2C are not available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert

dhalbert commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

I2C should be fixed. I tested scanning an MSA301. If you compile with CONSOLE=1, the STEMMA port becomes a console port, as described in console.overlay.

NeoPixel support is To Be Done, as we probably want to use PIO, and we need to do PIO management.

Thanks for testing!

@mikeysklar
mikeysklar enabled auto-merge October 22, 2026 23:31
@mikeysklar

Copy link
Copy Markdown
Collaborator

Sounds good. Auto-merge enabled.

@mikeysklar mikeysklar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@mikeysklar
mikeysklar merged commit 9bf49b3 into adafruit:main Oct 23, 2026
13 checks passed
@dhalbert
dhalbert deleted the zephyr-cp-macropad-rp2040 branch October 23, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants