I2c not detected, STMf303 to RPi 3B+

Ahoj,

ok, I spent some time for it.

Mbed’s side:
Nucleo-F303R8 with MbedOS 6.2.1 bare metal profile.
Copy&Paste example from documentation I2CSlave API (same what I wrote in your previous post)
I changed only pins in the constructor of I2C object from D14,D15 to D4,D5 according to Nucleo’s page

RPI’s side:
Raspberry PI 3 model B.
After long time I installed Raspbian (now called Raspberry Pi OS) again. In the clean installation I enabled I2C in a raspi-config according to this guide.
Then I wrote sudo i2cdetect -y 1 to RPI’s terminal and the Mbed slave device was found on address 0x50h(7bit) and that is 0xA0h (8bit) from the example .

Finally:
I’m not 100% sure but it looks like the problem what you have is the address what you chose because with your address 0x05h of the mbed slave device it not work.
If I correctly understand the description of address method of I2C API, the address must be placed in the 8 bit format. So if you want 0x05h (7bit) you need to place 0x0Ah (8 bit) into address method.
Your address 0x05h (8bit) was used as 0x02h(7bit) and 0x00h-0x02h are probably reserved addresses. So as a minimum you can use 0x06h (8bit).

I tried it on Mbed OS 6.2.1, you probably use a lower version then 6 but it will be similar.

Tips:

  • I use 4k7 pull-ups connected to 3.3V but 5V is also working.
  • When you use only printf witout an object you not need to declare the Serial object.
  • The letter E is missing in your code.
//slave.frquency(100000);  

BR, Jan