2023-09-09 2:43 AM
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 ?
2023-09-09 4:46 AM
Your converter also needs supply voltage and GND
LV = 3V, HV=5V, GND = GND
2023-09-09 4:58 AM
Hello @asking
Can you add your code to take a look on it. Also, can you try using just the LCD.
Best regards.
II
2023-09-09 5:59 AM
Yes, only LCD works fine. also other I2C Devices like SM Pressure sensors works fine. Only problem is AMS5812 when i put on bus. No further scanning only - - - - .
Core is simple I2C Discovery code. i have enabled I2C3 with 400000HZ Fast Mode.
2023-09-09 6:00 AM
Yes i have connected LV to 3V, HV to 5V and GND to System GND Common for all systems.
2023-09-09 6:16 AM
Can you try using another I2C
2023-09-10 9:25 PM
Yes, i will try another i2c bus and update.
2023-09-11 2:17 AM
Hello @asking ,
The silver dot on the AMS 5812 marks the location of Pin 1. The AMS 5812 pinout is:
4.7 kOhm resistors should be used as pullups on SDA and SCL, these resistors should pullup with a 5V source.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-09-14 2:12 AM
Yes i have double checked the connection. now trying with scope on I2C Bus....
2023-09-14 4:42 AM - edited 2023-09-14 4:44 AM
SCL / SDA on Scope. Below Observations.
With AMS5812 Sensor, Peak is curved.
Yellow is SDA and Violet is SCL
Without AMS5812 Sensor. I2C Scanner works fine.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.