10 years, 1 month ago.

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

Hi

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?

Why?

2 Answers

9 years, 3 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...

9 years, 3 months 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
...
while(True)
   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 ?