cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L476RG wrong I2C pins generated for I2C1?

envenomator
Visitor

Hi all,

I'm starting to just get the hang of STM32 using a Nucleo-L476RG board.

Discovering I2C, I'm finding the STM32CubeMX generates the I2C1's SDA/SDL pins for this board at PB7/PB6, not at all where they are according to the schematic (should be PB9/PB8). I've repeated the 'new project' steps a few times to cancel out me using an incorrect nucleo board.

Connecting up a sensor to PB7/PB6 (using physical pins on rows CN7/CN5, I2C works just fine.

All documentation I've found using this nucleo board, shows STM32CubeMX generating SDA/SDL on pins PB9/PB8.

Am I doing something wrong here, or might this be an issue in the STM32CubeMX version (6.12.1.202409122256 I'm using?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The board doesn't have I2C enabled by default. When you enable I2C, it picks the default pins based on the chip and the pins that are open, not on any per-board defined table.

If you want to use different pins, you can select them by enabling I2C, then picking PB8/PB9 and the I2C functions on them.

TDK_0-1727625597050.png

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

The board doesn't have I2C enabled by default. When you enable I2C, it picks the default pins based on the chip and the pins that are open, not on any per-board defined table.

If you want to use different pins, you can select them by enabling I2C, then picking PB8/PB9 and the I2C functions on them.

TDK_0-1727625597050.png

 

If you feel a post has answered your question, please click "Accept as Solution".
envenomator
Visitor

Thanks!

Weird thing is, when enabling I2C1, it selects PB7/PB6 by default. When I deselect these to reset state and THEN manually select PB9/PB8 to IC21, the board schematic matches up (and works)