cancel
Showing results for 
Search instead for 
Did you mean: 

Setup I2C slave to have more than two addresses

kennethf
Associate II
Posted on June 24, 2014 at 09:41

Hi ST,

I am using the STM32L151 processor on a custom made PCB. I use the I2C2 port as a slave and a GUI on my computer as master. The I2C1 port is setup as a master to control 12 slaves. 

The purpose is that the GUI should control the 12 slaves through the STM32L151 processor, and for that I need the processor to ACK on 12 different slave addresses plus 1 address for the processor itself. So 13 different slave addresses should be ACK from the STM32. 

Currently my porgram only interrupts on two slave addresses set in OAR1 and OAR2, but there must be some other interrupt that I can use to manually compare addresses from the GUI?

Unfortunatly I can not just include the 12 slave addresses in the datastream from the GUI, since it is a fixed standard that, unaltered, should also work with other I2C devices.

So my question is. Is there some interrupt that is called when an address is detected, that I can acces from software, so that I can manually decide if there is a match?

Any reply would be greatly appreciated.

Kind regards

Kenneth Blaabjerg Fog 

#stm32 #i2c
2 REPLIES 2
chen
Associate II
Posted on June 25, 2014 at 11:46

Hi

No, I do not think there is a way to make the STM32 respond to 13 I2C addresses.

It only has registers for 2 slave addresses.

The easiest way is to change the requirements slightly :

''The purpose is that the GUI should control the 12 slaves through the STM32L151''

Have a single address to control the slaves (the STM32 can respond to that address)

Part of the I2C protocol now, must have a slave address in the message stream.

The STM32 knows that on the slave control I2C address, there is a field in the I2C message to find which slave to pass the message onto.

Hope this helps.

kennethf
Associate II
Posted on June 26, 2014 at 11:31

Thanks for your reply. 

Thats unfortunate. Changing the GUI is something I would rather avoid, since it is build as a standard interface. But thanks for your answer, it is greatly appreciated.