Skip to content

variant(wb55): fix STeaMi P19/P20, expander pad defines and tone timer - #3131

Merged
fpistm merged 3 commits into
stm32duino:mainfrom
nedseb:variant/steami-pins-timers
Dec 2, 2026
Merged

fpistm merged 3 commits into
stm32duino:mainfrom
nedseb:variant/steami-pins-timers

Conversation

@nedseb

@nedseb nedseb commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2526 and #3126 (STeaMi board, STEAM32_WB55RG).

Summary

Three small changes to variant_STEAM32_WB55RG.h, one commit each, if I read the board files correctly:

  • Bug: P19 and P20 are swapped. On the board schematic, PC0 is I2C3_SCL_EDGE and goes to the P19 edge contact, PC1 is I2C3_SDA_EDGE and goes to P20, as on the micro:bit edge connector (P19 = SCL, P20 = SDA). The .cpp of the variant already says PC_0, // P19/D17 and PC_1, // P20/D18, and I2C_EXT_SCL/I2C_EXT_SDA (so Wire) are right; only the P19/P20 aliases were swapped.

  • Small change: TIMER_TONE and TIMER_SERVO are swapped (TIM17 for tone, TIM16 for Servo). The STM32WB55 has no TIM6/TIM7. TIM16 is the only timer of PA6 (edge contact P10), so today tone() and analogWrite(P10) share a timer, while TIM17 has no default PWM pin on the edge connector. The board has a buzzer, and most sketches use tone(), so I thought it better to give tone() the timer without edge pins. Servo then shares TIM16 with analogWrite(P10), which I think is a rarer case.

  • Small change: Remove P24, P25, P28 and P29 expand to GPIO1..GPIO4 which are not defined anywhere.

Motivation

The P19/P20 and pad disagree with the board and its documentation. For the timers, an LED on P10 driven with analogWrite() is disturbed as soon as the sketch plays a sound.

Validation

Built with PlatformIO (STM32duino core 3.1.0 package, with this variant folder):

  • a sketch with Servo on P0, analogWrite(P10, 128) and tone(SPEAKER, 440), plus a check that TIMER_TONE == TIM17 and TIMER_SERVO == TIM16;
  • a sketch with P19/P20 as GPIO and with Wire.setSCL(P19)/Wire.setSDA(P20), which checks P19 == PC0, P20 == PC1 and that P24..P29 are no longer defined;
  • the examples of the STeaMi board library (https://github.com/steamicc/arduino-steami-lib).

The STM32WB55 has no TIM6/TIM7, so tone() used TIM16. If I read
PeripheralPins.c correctly, TIM16 is the only timer of PA6 (P10 on the
edge connector), so tone() and analogWrite(P10) shared the same timer.
TIM17 has no default PWM pin on the edge connector.

The board has a buzzer and tone() is the more common call, so give it
TIM17 and let Servo use TIM16. Servo now shares TIM16 with
analogWrite(P10). Both defines are still guarded by #ifndef, so the
previous choice can be restored with build flags.

Signed-off-by: Sébastien Nedjar <sebastien.nedjar@univ-amu.fr>
On the board schematic, PC0 is I2C3_SCL_EDGE and goes to the P19 edge
contact, and PC1 is I2C3_SDA_EDGE and goes to P20, as on the micro:bit
edge connector (P19 = SCL, P20 = SDA). The variant .cpp already says
"PC_0, // P19/D17" and "PC_1, // P20/D18", and I2C_EXT_SCL/I2C_EXT_SDA
are right, but the P19 and P20 aliases were swapped.

Signed-off-by: Sébastien Nedjar <sebastien.nedjar@univ-amu.fr>
P24, P25, P28 and P29 expanded to GPIO1..GPIO4, which are not defined
anywhere, so a sketch using them did not compile. These pads are on the
MCP23009E I2C expander, not on the MCU, so they cannot have an Arduino
pin number.

Remove the four defines and keep the expander mapping as a comment,
with the datasheet pin names GP0..GP7 instead of the schematic net
names GPIO1..GPIO8.

Signed-off-by: Sébastien Nedjar <sebastien.nedjar@univ-amu.fr>
@fpistm fpistm added the enhancement New feature or request label Dec 2, 2026
@fpistm fpistm added this to the 3.2.0 milestone Dec 2, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in STM32 core based on ST HAL Dec 2, 2026
@fpistm
fpistm merged commit 1f4e430 into stm32duino:main Dec 2, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in STM32 core based on ST HAL Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants