2018-03-30 10:13 PM
I want to connect 2 i2c devices of the same type(having same i2c slave address) to my MCU if I want to communicate with those devices which device is responding to master. How should I differentiate those same devices
2018-03-30 10:37 PM
You cannot connect two devices with identical slave address on I2C bus.
First of all. Check if your device has inputs for 'user selectable address'. If it has, you can change slave addres to one of them ...If not, you can use two different I2C buses (STM usualy has plenty of them) or 'Bus switch' (like PCA9543) M.2018-03-31 02:52 AM
Apart from great solutions provided by
Dudka.Michal
you can use software based I2C solution (in case you lack of another I2C bus e.g. pins are already occupied for another purpose):http://download.mikroe.com/documents/compilers/mikroc/arm/help/software_i2c_library.htm
2018-03-31 04:48 AM
You need to know very well your slave spec.
Think powering up the slave with MCU GPIO if feasible and unpowered slave keeps its I2C pins true open drain.
You could also use other alternate function pins for the same I2C Cell to have like 2 buses from same HW I2C Cell.
Actually in this case, just a different sda could be enough (sharing same clock line)
2018-03-31 05:23 AM
dudka.michal.001 wrote:
First of all. Check if your device has inputs for 'user selectable address'.Yes, that is the obvious first step!
It would be a rather stupid I2C peripheral which did not provide some facility to adjust its Slave Address.
Failing that, you could see if the device has some way to 'inhibit' its I2C interface; eg, take a look at
http://www.st.com/resource/en/application_note/dm00280486.pdf
2018-03-31 06:54 AM
Hello
Few months ago, the lack of documentation from the HAL Library forced me to develop a software I2C routines.
Maybe the following link will help you.
https://community.st.com/0D50X00009bMM7pSAG
Best regards
JC