I2c slave does not response

i am trying to communicate between two nucleo f767zi board by using i2c communication. in slave nucleo board initialize the slave address 0x12 as well as in master board.then try to write in slave from master, but slave didn’t response/ didn’t give ask to master. below my master and slave code .

*/**************master ***************/
 #include "mbed.h"

// main() runs in its own thread in the OS
const int addr8bit = 0x12 << 1; // 8bit I2C address, 0x90
I2C master(D14,D15);
Serial pc(USBTX,USBRX);
int main()
{
    char count[]="master",cmd[8];
    pc.baud(115200);
    while (true) {
        
        
         master.write(addr8bit,count, 7);
         ThisThread::sleep_for(1000);
        


    }
}
*/********slave***/*
#include "mbed.h"

// main() runs in its own thread in the OS

I2CSlave slave(D14,D15);
Serial pc(USBTX,USBRX);
int main()
{
    const char count[]="master";
    char buff[8];
    pc.baud(115200);
    slave.address(0x12);
    while (true) {
        
        
          slave.read(buff, 8);
          pc.printf("%s",buff);
         ThisThread::sleep_for(1000);
        


    }
}

Hello,

your master only sending msg “master” every one sec and your slave trying to read every 1 sec what received from master. In general your code do not contain any code what can send any responce to master, only ACK.

Would be cool to start from I2CSlave example - I2CSlave - API references and tutorials | Mbed OS 6 Documentation

BR, Jan