2024-11-13 09:46 PM
SD Card (SPI1):
CS: PA5
MISO: PA6
MOSI: PA7
CK: PA1
Temperature Sensor (I2C1):
SDA: PB7
SCL: PB6
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.
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.
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?
Solved! Go to Solution.
2024-11-24 04:58 PM
Hey, my intention was only red flagging this situation in case it was clear why this was happening.
But if it is not it is not worth it to keep digging since for me, with this remapping I mentioned it worked.
THank you very much for your time. I will set this thread solved.
2024-11-14 02:57 AM
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.
2024-11-14 03:03 PM - edited 2024-11-14 03:04 PM
Hi @ELABI.1,
Let me clarify regarding your questions:
To better explain the sequence of events:
SD Card (SPI1):- CS (GPIO): PA5- MISO: PA6- MOSI: PA7- SCK: PA1
This suggests a peripheral conflict rather than a pin configuration issue. After finding similar issues documented in other STM32 erratas, I resolved it by remapping:
Now both peripherals work correctly together. Hope this helps clarify the situation.
Thanks in advance.
2024-11-14 04:48 PM
@marianoo2001 wrote:
This suggests a peripheral conflict .
Or a problem in the software.
Have you tried debugging why the SD Card is not mounting?
2024-11-14 05:41 PM - edited 2024-11-14 05:42 PM
Hi @Andrew Neil,
Yes, I did extensive debugging to isolate the issue:
Key observation: Using the exact same:
The only difference was enabling I2C in the IOC. This simple action consistently reproduced the issue:
While I've found a workaround by remapping the pins, I'm sharing this because:
I leave it to you whether this warrants further investigation. If you believe it's purely a software issue, feel free to close this thread. However, the fact that merely enabling I2C in IOC (without any code changes) causes the SD Card to stop working suggests a deeper peripheral interaction issue.
2024-11-15 01:10 AM
What activity is happening on the I2C?
2024-11-15 02:07 AM - last edited on 2024-11-15 05:50 AM by SofLit
@marianoo2001 wrote:
After finding similar issues documented in other STM32 erratas, I resolved it by remapping:
Could you please precise where did you find a similar issue please?Thanks.
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.
2024-11-17 10:56 PM
Similar issue I found, for another board, that made me try different pins configurations:
https://community.st.com/t5/stm32-mcus-products/spi-stops-working-when-enable-i2c/td-p/98433
Regards,
Mariano.-
2024-11-17 10:57 PM
Even with no code related to I2C, at the moment I enable I2C it stopped working.
Regards.
2024-11-18 12:58 AM - edited 2024-11-18 01:24 AM
@marianoo2001 wrote:Similar issue I found, for another board, that made me try different pins configurations:
https://community.st.com/t5/stm32-mcus-products/spi-stops-working-when-enable-i2c/td-p/98433
So have you checked your chip's Errata - is the same thing mentioned there?
Or anything else relevant?