Question
AMS5812 I2C Sensor Holding I2C3 Bus on STM32F407G-DISC1
- September 9, 2023
- 4 replies
- 6832 views
I am trying to implement LCD and AMS5812 Sensor on I2C3 Bus,
But AMS5812 I2C sensor is holding the I2C bus and preventing further scanning STM32F407G Discovery board.
/*-[ 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

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 ?