cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2 MCU as I2C master unable to communicate with I2C slave devices with 7 bit I2C address between 120-124

Pranay Dhuri
Associate II
Posted on June 30, 2018 at 07:42

Hi,

I have implemented I2C master on STM32F207VG and performing I2C bus scan for slave detection.

I am having a slave device whose I2C address can be modified.

It is working fine with all addresses except addresses 120,121,122,123,124. When I change my slave I2C address to any of these, STM32 fails to detect it, whereas when I am testing same device with Arduino as master it is being detected on bus.

Are there any limitations on I2C slave addresses with STM32 controller?

If no, then what can be reasons for not responding to particular address range.

Thanks in advance.

4 REPLIES 4
T J
Lead
Posted on June 30, 2018 at 14:52

only to say ,

1. make sure you are 100KHz or under to be well within operating speed.

2. no long wires.nothing over 2cm or else you are the problem. drop your speed again

3. strong pullups help, try 1K pullup.

how many devices on the bus ?

Posted on July 02, 2018 at 08:54

Hi T J, I am operating I2C bus at 100KHz, I have tested with only one device on bus. Problem is arriving, if i modify slave address between 120 -124.

Danish1
Lead II
Posted on July 02, 2018 at 13:43

Looking at the I2C specification

https://www.nxp.com/docs/en/user-guide/UM10204.pdf

 section 3.1.11, I think 7-bit addresses 0b11110xx are forbidden because they are used to indicate a 10-bit address being used.

Can the Arduino cope with 10-bit I2C addresses? If not it might wrongly allow that sequence as a 7-bit address. But stm32 should properly handle 10-bit addresses.

Hope this helps,

Danish

Posted on July 03, 2018 at 14:22

Stick a scope on the pins, and confirm a) the address sent, and b) the response from the slave via ACK

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..