Home > OS >  I2C connection between 2 stm32 - i2c device id
I2C connection between 2 stm32 - i2c device id

Time:08-12

I am new into ARM devices and trying to connect 2 stm32f103 similar devices by I2C bus. But the main problem is to find each i2c device id. It is clear for operating with some sensors, cause they have it in datasheets. So where can i find IDs or if it is in datasheet or RM - where exactly? Or may be I should define them manually?


Thanks in advance!

CodePudding user response:

So where can i find IDs or if it is in datasheet or RM

You probably did not read the RM. Everything is explained there. You probably did not read how the I2C bus works.

  1. Set the I2C peripheral (clocks, timings etc etc)

  2. One device has to be MASTER another one SLAVE.

  3. Set the SLAVE device address (I2C peripheral I2C_OAR1 register)

  4. Master sends the START with SLAVE device address and SLAVE dice ACKs it.

  5. You can communicate between the devices.

CodePudding user response:

The I²C modules in microcontrollers like STM32 do not have a fixed address, you need to choose one and set up respective registers.

Read chapter 26 of the reference manual, and you will find the register descriptions in chapter 26.6.

  • Related