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.
Set the I2C peripheral (clocks, timings etc etc)
One device has to be MASTER another one SLAVE.
Set the SLAVE device address (I2C peripheral
I2C_OAR1
register)Master sends the START with SLAVE device address and SLAVE dice ACKs it.
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.