liyanboy74 / soft-i2c

Software I2C
35 stars 14 forks source link

SW_I2C_Read_Data function bug #5

Closed xuanwoafei closed 11 months ago

xuanwoafei commented 1 year ago

Problem: The 8th bit cannot be detected Resolve: d->hal_delay_us(SW_I2C_WAIT_TIME) should place before d->hal_io_ctl(HAL_IO_OPT_SET_SCL_HIGH, NULL)

liyanboy74 commented 1 year ago

I think this is related to the slave device. In this code, the received data is read on the rising edge of SCL. What device did this error occur in connection with?

You use SW_I2C_Read_8addr function or directly use SW_I2C_Read_Data ? The function SW_I2C_Read_Data not in header file and can't be use directly! standard function is :

SW_I2C_Read_8addr
SW_I2C_Read_16addr

in this functions, we have delay before call SW_I2C_Read_Data in first time.