cancel
Showing results for 
Search instead for 
Did you mean: 

I2C register I2C_SR3 in the field BUSY getting stuck in High level

GGhed.1
Associate II

I am having an issue with the I2C communication between the MCU STM8208C6 and the Ambient Light Sensor APDS 9306-065.

Before any setting is set up during the debugging, the I2C register I2C_SR3 in the field BUSY is 1.

• I checked if there was any short circuit in the SCL and SDA pins, but none was found.

• In the oscilloscope both SDA and SCL pings are high (+3V3) before the start condition.

• I am making use of STM8S/A Standard peripheral library and IAR IDE.

The code for the I2C setup is the following:

void I2C_Config(void)

{

I2C_DeInit();

   I2C_Init(

(20000), 

      (0x00000000), 

      I2C_DUTYCYCLE_16_9, 

     I2C_ACK_NONE, 

     I2C_ADDMODE_7BIT,

     (CLK_GetClockFreq() / 1000000));

I2C_Cmd(ENABLE);

}

I have implemented a lock-up recovery function that sends 10 clock signals in the SCL, but the I2C_SR3 remains in BUSY high state.

From time to time I was able to read the Part Number (ID) of the sensor via I2C, but just following that the register I2C_SR3 - BUSYgot stuck in high state, then I was unable to read the other data.

(I such cases the I2C_SR3 - BUSY was in low state when I started the debug, but most of the time it was being initialized in high state and I could not read anything).

I do not think the problem might be in the firmware, the same code had worked in a previous sensor ISL29035.

I just wonder if it might be an internal issue of this sensor or the MCU.

0 REPLIES 0