I'm trying to use the I2C device on my STM8S105. On this MCU I2C is implemented as alternative function. I've set the AF6 flag for I2C so that it should work. But when I send the start flag, the control of “I2C_CheckEvent(I2C_EVENT_MASTER_START_SENT)� fails and the program hangs. On the oscilloscope I can see that SDA is pulled down to low level, so only the flags are not set by hardware. The same code works fine on STM8S208 and STM8S103. On this MCUs I2C can be used directly. Are there any other settings needed for using alternative functions? Best regards!
The Pollloop is a failsafe, its value is unimportant. Under normal circumstances the polling will end quickly. But if a straight while loop is used, if something goes wrong execution will hang . At least if the function returns an error the error can be tracked down more easily.