cancel
Showing results for 
Search instead for 
Did you mean: 

i2c communication between two different stm32 evk boards

Tharun123
Associate

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.

2 REPLIES 2
Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

@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:

  • Is the problem in the Master?
  • Is the problem in the Slave?
  • Are there problems in both Master and Slave?

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,

  • Missing slave device
  • One wire disconnected
  • Pullups missing

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://www.i2c-bus.org/

https://learn.sparkfun.com/tutorials/i2c/all

 

#BothEnds