AnsweredAssumed Answered

stm8s208cb(Slave) and stm8s105c6t6(Master) I2C Communication

Question asked by sakarya.erhan on Feb 5, 2016
Latest reply on Feb 6, 2016 by kk
Hello,

I want to use I2C communication between stm8s208cb(slave) and stm8s105c6t6(master). I use stm8s standard peripheral library.

stm8s105c6t6(master) code:
-in the void main
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //16MHz clock
I2C_Init(400000, 0xA0, I2C_DUTYCYCLE_2, I2C_ACK_CURR, I2C_ADDMODE_7BIT, 16); //i2c init
I2C_Cmd(ENABLE);
I2C_GenerateSTART(ENABLE); //send start condition
I2C_Send7bitAddress(0x30, I2C_DIRECTION_TX); //send slave address for write
/********************************************************************/
-in the while(1)
I2C_GenerateSTART(ENABLE);
I2C_SendData(0x61);
I2C_GenerateSTOP(ENABLE);

stm8s208cb(slave) code:
-in the void main
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //16MHz System Clock
I2C_DeInit();
I2C_Init(400000, 0x30, I2C_DUTYCYCLE_2, I2C_ACK_CURR, I2C_ADDMODE_7BIT, 16);
I2C_Cmd(ENABLE);
-in the while(1)
uint8_t RxBuffer = I2C_ReceiveData();

But it does not work. Help please, thank you!

Outcomes