cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and I2C Pin Conflict Issue on NUCLEO-L412KB

marianoo2001
Visitor

 

Hardware Setup

  • Board: NUCLEO-L412KB
  • Peripherals:
    • SD Card (SPI1)
    • Temperature Sensor (I2C1)

Original Pin Configuration (SPI Not Working properly)

SD Card (SPI1):
CS: PA5
MISO: PA6
MOSI: PA7
CK: PA1
Temperature Sensor (I2C1):
SDA: PB7
SCL: PB6

Issue Description

When using both SPI1 and I2C1 peripherals simultaneously with the above pin configuration, the SPI communication fails to work properly. Interestingly, when commenting out the I2C initialization, the SPI communication functions correctly.

Working Solution

I resolved the issue by remapping the pins as follows:

 

 
Modified Pins:
SPI1_MOSI: Changed to PB5
I2C1_SDA: Changed to PA10
I2C1_SCL: Changed to PA9

After this remapping, both peripherals work correctly together.

Suggestion

This pin conflict might be worth documenting in the board's errata, as the original configuration leads to unexpected behavior when using these common peripherals together.

Has anyone else encountered similar issues with this board when using SPI1 and I2C1 simultaneously?

1 REPLY 1
ELABI.1
ST Employee

Hi @marianoo2001 

For the SPI1 configuration, why did you choose pin PA5 as CS? According to the datasheet, pins PA4 and PB0 can be used as CS, while pin PA5 is used for SCK.

Have you tried configuring I2C with pins PB7 & PB6 alone without using SPI1? If so, did it work or not? This would help determine if the issue is related to I2C.

Thank you.

ELABI.1

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.