Skip to content

boards/common/nucleo144: fix and complete Arduino configuration#21665

Merged
gschorcht merged 4 commits intoRIOT-OS:masterfrom
gschorcht:boards/common/nucleo144/fix_complete_pin_config
Aug 20, 2025
Merged

boards/common/nucleo144: fix and complete Arduino configuration#21665
gschorcht merged 4 commits intoRIOT-OS:masterfrom
gschorcht:boards/common/nucleo144/fix_complete_pin_config

Conversation

@gschorcht
Copy link
Copy Markdown
Contributor

Contribution description

This PR includes some fixes of Arduino pin configurations for Nucleo144 boards with L4, L5 and U5 and completes the Arduino configuration for I2C, SPI, and UART devices of Nucleo144 boards.

In detail:

  1. On Nucleo144 boards for L4, L5 and U5, Arduino connector pins D0/D1 have a different configuration. According to the user manuals for
  2. According to the user manuals Arduino pins D14/D15 are GPIOs PB9/PB8. The configuration was mixed up. I2C_DEV(1) uses PB9 as SDA and PB8 as SCL signals that have to be mapped to Arduino pins D14=SDA and D15=SCL, respectively, to be compatibly with Arduino shields.
  3. Nucleo144 boards for L5 and U5 have a completely different analog pin configuration.
  4. Defines for ARDUINO_UART_D0D1, ARDUINO_SPI_D11D12D13 and ARDUINO_I2C_UNO` as well as the corresponding features were added.

Testing procedure

t.b.d

Issues/PRs references

@gschorcht gschorcht requested a review from aabadie as a code owner August 18, 2025 08:19
@github-actions github-actions bot added the Area: boards Area: Board ports label Aug 18, 2025
@gschorcht gschorcht added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 18, 2025
@gschorcht gschorcht requested review from maribu and removed request for aabadie August 18, 2025 08:20
@gschorcht
Copy link
Copy Markdown
Contributor Author

@maribu I'm a little bit confused with the defines of ARDUINO_UART_D0D1 and ARDUINO_I2C_UNO that I have just copied from boards/common/nucleo64/arduino_iomap.h.

From my understanding, these macros should define the mapping of the corresponding Arduino pins to the configured devices. Therefore I'm wondering whether the definitions shouldn't be

#define ARDUINO_UART_D0D1       UART_DEV(1)
#define ARDUINO_I2C_UNO         I2C_DEV(1)

because the Arduino pins D0/D1 are connected to the GPIOs configured for UART_DEV(1) and the Uno I2C pins D14/D15 are connected to the GPIOs configured for I2C_DEV(1). This is the case for Nucleo64 and Nucleo144 boards.

@riot-ci
Copy link
Copy Markdown

riot-ci commented Aug 18, 2025

Murdock results

✔️ PASSED

b889024 boards/common/nucleo144: complete Arduino config for I2C, SPI and UART

Success Failures Total Runtime
10557 0 10559 20m:20s

Artifacts

@maribu
Copy link
Copy Markdown
Member

maribu commented Aug 18, 2025

Hmm, I actually testes this with the Peripheral Selftesting shield for some Nucleo 64 boards. It could be that the UART test is skipped, if the D0/D1 UART is also used for stdio, though. But at least I2C was definitely correct for the boards I ran the tests on at the time of the PR. Maybe the periph_conf has changed in the meantime without updating the I/O mapping?

The mapping should definitely match the standard Arduin UNO position, otherwise making use of the same shield across boards with the same app will not work.

@maribu
Copy link
Copy Markdown
Member

maribu commented Aug 18, 2025

@gschorcht I have not tested this yet. I couls do so tomorrow with the self-testing shield, but if you feel confident, feel free to just hit the green button.

Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

I don't have any of the Nucleos in question for testing.

@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Aug 18, 2025

But at least I2C was definitely correct for the boards I ran the tests on at the time of the PR.

#define ARDUINO_I2C_UNO         I2C_DEV(0)

is correct, of course. But, GPIOs for D14 and D15 were definitely mixed up. Did you also test it with any Nucleo144 boards?

@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Aug 18, 2025

Hmm, I actually testes this with the Peripheral Selftesting shield for some Nucleo 64 boards. It could be that the UART test is skipped, if the D0/D1 UART is also used for stdio, though

Okay, I checked again: On all Nucleo-64 boards, rx_pin and tx_pin of UART_DEV(0) correspond to the Arduino pins D0 and D1 so that

#define ARDUINO_UART_D0D1       UART_DEV(0)

is correct. But, for all Nucleo-144 boards Arduino pins D0 and D1 correspond to rx_pin and tx_pin of UART_DEV(1) so that it should be:

#define ARDUINO_UART_D0D1       UART_DEV(1)

Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

While we're at it...

@gschorcht
Copy link
Copy Markdown
Contributor Author

While we're at it...

Oops, I forgot to remove the two spaces 😎 too bad.

Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Please squash :)

According to user manuals the pin configuration for Arduino pins D14/D15 is PB9/PB8. The configuration was mixed up. Furthermore, I2C_DEV(1) is configured correclty with SDA=PB9 and SCL=PB8 that have to be mapped to Arduino pins D14=SDA and D15=SCL, respectively, to be compatibly with Arduino shields.
@gschorcht gschorcht force-pushed the boards/common/nucleo144/fix_complete_pin_config branch from db002fe to 43cf29d Compare August 19, 2025 11:24
@gschorcht gschorcht enabled auto-merge August 19, 2025 11:28
@gschorcht
Copy link
Copy Markdown
Contributor Author

Thanks for reviewing and approving.

@gschorcht gschorcht added this pull request to the merge queue Aug 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2025
@gschorcht gschorcht added this pull request to the merge queue Aug 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2025
Nucleo144 boards for L5 and U5 have a completely different analog pin configuration. It's a very small change, but due to style changes it seems like a big change. In fact, the configuration has been changed just by adding an #ifdef ... #else ... #end and the six analog pins for L5 and U5 boards.
@gschorcht gschorcht force-pushed the boards/common/nucleo144/fix_complete_pin_config branch from 43cf29d to b889024 Compare August 19, 2025 13:41
@gschorcht gschorcht enabled auto-merge August 19, 2025 13:42
@gschorcht gschorcht added this pull request to the merge queue Aug 19, 2025
Merged via the queue into RIOT-OS:master with commit 216ef04 Aug 20, 2025
25 checks passed
@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants