2025-05-23 6:40 PM
Hi, newbie here - I have some experience with the f4 series, but am working on a small project for which I would like to try a stm32u0 MCU.
Looking at the stm32u031 20-pin TSSOP, I am confused by something. When I load this MCU in cubeMX, and tick on I2C 1, I see a single pin 'light up' for both SCL and SDA. The datasheet implies I should be able to choose a pin with an alternate function for one of these, but I can't figure out how I might do this....I see pin PA8 seems to have an alternate mapping to PA9, which seems like it might work for i2cSCL, but I don't know how to select it.
I feel like an ***, but I'm unsure how to configure this using cubeMX, or how one is meant to work with these apparently-double-functioned pins?
Thanks!
2025-05-23 7:24 PM
The best thing to do is left click on the pin and do Reset_state so that both pins are not selected. Then left click again to choose either PB8 or PB9 and the appropriate SCL/SCL assigned to it.
For pin#1, you can choose if it's SCL or SDA.
If you choose pin# 1 as SCL (PB8), then pin# 19 (PB7) will be SDA
If you choose pin# 1 as SDA (PB9) , then pin# 18 (PB6) will be SCL
You can always do a search for a specific pin which will highlight it. In this case I've chosen PB8 as SCL. so now I'm looking for I2C1_SDA, which shows PB7 is SDA. So you can left click that pin and select I2C1_SDA