Skip to content

Zephyr port: bring back board.I2C, board.SPI and board.UART on non-Nordic boards - #11590

Open
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:busio-dt-buses
Open

mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:busio-dt-buses

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

Non-Nordic Zephyr boards get their board.I2C, board.SPI and board.UART back.

Why

Since runtime pin routing landed, every non-Nordic bus looks routable at runtime.

So those buses vanish from board, and busio refuses pins too.

Bus objects in the generated board.c, main → this PR:

Boards Before After
Pico, Pico W, Pico 2, Pico 2 W, Feather RP2040 0 3, 4, 3, 4, 3
SiWx917-DK2605A 0 3
NUCLEO-N657X0-Q, NUCLEO-U575ZI-Q, STM32H750B-DK, STM32H7B3I-DK 0 6, 6, 2, 4
FRDM-MCXN947, MIMXRT1170-EVK 2, 1 7, 3
8 nRF boards, EK-RA6M5, EK-RA8D1, native_sim unchanged unchanged
Board Test Result
Pico W board.I2C(), board.SPI0(), board.UART() construct (none existed before) 3/3
nRF54LM20 DK Same bus names; busio.I2C and busio.SPI on any pins still work 3/3

Not tested on hardware: STM32, NXP, SiWx917.

Written with Claude; tested on hardware by me.

🤖 Generated with Claude Code

The iobroker check treated a bus as routable at runtime when every nRF
psel in its default pinctrl state was disconnected. Pinctrl states on
other SoCs have no psels, so the list was empty, all() returned True,
and every I2C, SPI and UART on RP2, SiWx917 and other non-nRF
boards was dropped from board. busio then refused pins too.

Only treat a bus as routable when it has psels and all are disconnected.
Move the check into a helper so it can be tested.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for breaking this! I think we may want to know the vendor to ensure our bitmask is relevant.

if psels is not None and all(
(value & NRF_PIN_FIELD_MASK) == NRF_PIN_FIELD_MASK for value in psels
):
if _dynamically_routable(device_tree.label2node[labels[0]]):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we actually know this is a nordic bus?

@dhalbert dhalbert 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.

Did this happen due to one of my recent PR's? I think this will be fixed as part of my series of PR's. I'm finishing nordic now.

@dhalbert

dhalbert commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

I am going to fix this as part of #11596

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.

3 participants