Question
stm8s208cb(Slave) and stm8s105c6t6(Master) I2C Communication
Posted on February 05, 2016 at 14:24
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 mainCLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //16MHz clockI2C_Init(400000, 0xA0, I2C_DUTYCYCLE_2, I2C_ACK_CURR, I2C_ADDMODE_7BIT, 16); //i2c initI2C_Cmd(ENABLE);I2C_GenerateSTART(ENABLE); //send start conditionI2C_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 mainCLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //16MHz System ClockI2C_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! #i2c #stm8 #i2c-example