HAL I2C and 24c02 eeprom communication problem
Hi.
I read 24c02 datasheet and tried to write my code to write and read a byte from this device. But my code does not work. Can you tell me what the problem is?
https://imghostr.com/M4hXKXT6A
void EEPROM_Write(unsigned char address,unsigned char data)
{
buff[0]=address;
buff[1]=data;
HAL_I2C_Master_Transmit(&hi2c1,0x50<<1,buff,2,10);
delay_ms(10);
}https://imghostr.com/fTqONyMAW
unsigned char EEPROM_Read(unsigned char address)
{
buff[0]=0;
HAL_I2C_Master_Transmit(&hi2c1,0x50<<1,buff,1,10);
HAL_I2C_Master_Receive(&hi2c1,0x50<<1|1,&buff[1],1,10);
deay_ms(10);
return buff[1];
} I put the image of datasheet and my code above.
