AMS5812 I2C Sensor Holding I2C3 Bus on STM32F407G-DISC1

38 Views Asked by At

I am trying to interface LCD and AMS5812 Sensor on I2C3 Bus of STM32F407G Discovery board,

But AMS5812 I2C sensor is holding the I2C bus and preventing further scanning STM32F407G Discovery board.

Please advise where i could be wrong ?

Using I2C Speed settings 400000HZ and I2C Speed Mode : Fast

Below is I2C Scanner Code for detecting the connected I2C Devices.

/*-[ I2C Bus Scanning ]-*/
         HAL_UART_Transmit(&huart2, (uint8_t *)StartMSG, sizeof(StartMSG), 10000);
         for(i=1; i<128; i++)
         {
             ret = HAL_I2C_IsDeviceReady(&hi2c3, (uint16_t)(i<<1), 3, 5);
             if (ret != HAL_OK) /* No ACK Received At That Address */
             {
                 HAL_UART_Transmit(&huart2, (uint8_t *)Space, sizeof(Space), 10000);
             }
             else if(ret == HAL_OK)
             {
                 sprintf(Buffer, "0x%X", i);
                 HAL_UART_Transmit(&huart2, (uint8_t *)Buffer, sizeof(Buffer), 10000);
             }
         }
         HAL_UART_Transmit(&huart2, (uint8_t *)EndMSG, sizeof(EndMSG), 10000);
         /*--[ Scanning Done ]--*/
         HAL_Delay(1000);

AMS5812 sensor is working on 5V and i2c LCD is also working on 5V. i am using 5V to 3V level shifter as below.

first time i2c Scanning code detect lcd address as 0x27 and then blank.

Expected 0x27 and 0x78

enter image description here

enter image description here

I have tried using 3.1K pull up resistors but no benefit on both the sides of level shifter.

Please advise where i could be wrong ?

0

There are 0 best solutions below