2024-12-18 05:36 AM
Hi everyone, I am trying to learn i2c communication between two stm32 microcontrollers. I am using stm32f407g Disk1 board as slave and stm32l100 disco as master I configured these boards I have provided source files below.
can you give any suggestions what i need to add or how i can able to communicate?
Thank you.
2024-12-18 05:42 AM - edited 2024-12-18 05:42 AM
Hello @Tharun123
I advise you start from this wiki article which explains -step by step- how to configure I2C to communicate between two boards and how to use I2C through examples: Getting started with I2C - stm32mcu
This FAQ may help you with tips related to I2C peripheral: STM32 I2C does not work - STMicroelectronics Community
2024-12-18 08:25 AM - edited 2024-12-18 08:27 AM
@Tharun123 wrote:Hi everyone, I am trying to learn i2c communication between two stm32 microcontrollers..
I would suggest that's not a great way to learn!
That means you have to implement both the slave and the master on the two separate MCUs.
The trouble is that, when you get problems, you then don't know:
A far better approach is to start with just one end of the link, and use a well-known, standard device at the other end to test against.
As by far the commonest (therefore, best supported) use case is to have the microcontroller as the Master, I would suggest that you start there.
Something like this provides some good test devices for your Master implementation:
https://www.microchip.com/en-us/development-tool/pkserial-i2c1
In developing your master, be sure to test it under common fault conditions; eg,
Get to understand how it behaves in such conditions.
Understand what good and bad signals look like on an oscilloscope.
Provide good diagnostics to give visibility of what's happening.
Then, once you have your master working well, you can start to develop a Slave to work with it.
I2C References:
The I2C-bus Specification and User Manual: https://www.nxp.com/docs/en/user-guide/UM10204.pdf
https://en.wikipedia.org/wiki/I%C2%B2C
https://learn.sparkfun.com/tutorials/i2c/all
#BothEnds