2016-02-05 05:24 AM
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-example2016-02-06 01:51 AM
Dear sakarya.erhan,
First debug your master, if it is generating correct waveform for init, start and stopn. You can see the master CLK and DATA pin on CRO or Logic Analyzer./*Please
mark helpfullif this post helps you or solves your problem.*/
/**disclaimer**/
/* I am not a person from ST Technical Support Team. So please verify/test any support/suggestion at your end.*/
/* This post is only for general support purpose and free of any charge.If you need any personal support for your work please contact at
embeddeddesign.help@gmail.com
*/