6 years, 10 months ago.

Can the same mbed be at the same time, slave and master(I2C)?


I am using just for testing both I2C Ports like this:

I2CSlave slave(p9, p10);

I2C i2c(p28, p27);

but it seems that the slave isnt acknowledging the master?


2 Answers

5 years, 12 months ago.

I get the same problem with the Nucleo152RE.

Looking at the HAL-Code in github shows me that they are doing nasty stuff with a global variable called I2cHandle. they do not update it correctly to allow more than one instance of i2c (slave or master).

Very bad...

6 years ago.

Hello, I'm working on Nucleo F411RE. I have the same problem : I2C (master) alone talks without (too much) problems. I2CSlave alone talks, but this does not work :

I2C master(PIN1, PIN2);
I2CSlave slave(PIN3, PIN4);

while (tempo)
   slave.receive() /// Receives data
master.write(something); /// Works correctly
   slave.receive() // Does not receive anymore

Has anyone a clue ? Thank you ...

Btw, I'm looking for a slave which would work by interrupts ... executing only on master's request ... Does not exist on MBed Nucleo ?