cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-master I2C example for STM32F0 (with CPAL)

arno
Associate II
Posted on February 09, 2016 at 09:10

Hi,

I'm looking for an example of a multi-master I2C configuration with the CPAL library (or a newer library if that works better / easier).

I currently have my application switching between master and slave mode, but this seems to be rather slow and it does not check if the I2C line is ''busy'' (in other words: another Master is already providing the clock and communicating with this/another device).

Anyone here that can help me?

PS: The user manual supplied with the CPAL mentions an example that uses the special Slave Listen mode. However, this example is not included, nor is that Listen mode defined in the actual sources.

Kind regards,

Arno Moonen

#stm32 #i2c #cpal #stm32f0
2 REPLIES 2
Walid FTITI_O
Senior II
Posted on February 10, 2016 at 18:28

Hi Arno,

Take a look to the ''I2C_TwoBoards_AdvComIT'' example in the STM32F0Cubef0 at the following path ; it will be helpful for your application :

stm32cubef0\STM32Cube_FW_F0_V1.2.0\Projects\STM32091C_EVAL\Examples\I2C\I2C_TwoBoards_AdvComIT

You can download the STM32F0Cubef0 from this

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260612

-Hannibal-

Hi,

I'm looking for an example of a multi-master I2C configuration with the CPAL library (or a newer library if that works better / easier).

I currently have my application switching between master and slave mode, but this seems to be rather slow and it does not check if the I2C line is ''busy'' (in other words: another Master is already providing the clock and communicating with this/another device).

Anyone here that can help me?

PS: The user manual supplied with the CPAL mentions an example that uses the special Slave Listen mode. However, this example is not included, nor is that Listen mode defined in the actual sources.

Kind regards,

Arno Moonen
arno
Associate II
Posted on February 17, 2016 at 09:00

Hi,

Thanks for your reply. Please note that we are using CPAL, not the STM32Cube libraries.

The tremendous delay was apparently caused by the logging I did via the JTAG interface.

Removing the logging, caused everything to start operating way better.

However, we are still facing some issues when we switch from slave mode to master mode.

What is the best way to do this when using the CPAL?

The library sometimes comes into a state where the master mode is active, but the address is matched (so an interrupt is fired). Unfortunately this interrupt only seems to be handled/cleared when the device is in slave mode.

So the interrupt keeps firing, until the device resets eventually.