2014-06-17 10:38 PM
hi clive
I am using Stm8 for using as i2c slave Device & stm32 as master . From master I am Sending 2 bytes of Data after address Problem i am getting is I am getting Data Only once after that only ist byte of data . Here is some Lines of Codes From Handler.INTERRUPT_HANDLER(I2C_IRQHandler, 19)
{ uint8_t b;if((I2C->SR1 & 0x02 )== 0x02)
{ b+=I2C->SR1; b+=I2C->SR3; } if ((I2C->SR1 & 0x40) ==0x40 ) { test1= I2C->DR; } //recieve[a]= I2C->DR; if ((I2C->SR1 & (0x40|0x04)) ==(0x40|0x04) ) { b=I2C->SR1; test2= I2C->DR; } if((I2C->SR1 & 0x10)== 0x10) { b+=I2C->SR1; I2C->CR2|= 0x02; } GPIOB->ODR^=1; }2014-06-23 05:58 AM
2014-06-27 07:36 AM
Maybe using the standard peripheral library for the stm8 would help things. It has helpful functions for changing flags and sending and receiving data in a more abstract manner. I2C was quite tough for me to get working even with the library...