cancel
Showing results for 
Search instead for 
Did you mean: 

AMS5812 I2C Sensor Holding I2C3 Bus on STM32F407G-DISC1

asking
Associate II

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 

asking_0-1694252450817.png

 

 

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

asking_1-1694252475072.png

 

Please advise where i could be wrong ?

9 REPLIES 9
Johi
Senior III

Your converter also needs supply voltage and GND

LV = 3V, HV=5V, GND = GND

Issamos
Lead II

Hello @asking 

Can you add your code to take a look on it. Also, can you try using just the LCD.

Best regards.

II

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.

Yes i have connected LV to 3V, HV to 5V and GND to System GND Common for all systems.

Can you try using another I2C 

Yes, i will try another i2c bus and update.

Foued_KH
ST Employee

Hello @asking , 

The silver dot on the AMS 5812 marks the location of Pin 1. The AMS 5812 pinout is:

  • Pin 2: Ground
  • Pin 4: SDA
  • Pin 5: SCL
  • Pin 7: VCC, this should be a 4.75V to 5.25V power source.

4.7 kOhm resistors should be used as pullups on SDA and SCL, these resistors should pullup with a 5V source.

Foued_KH_0-1694423677364.png

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.

Yes i have double checked the connection. now trying with scope on I2C Bus....

asking
Associate II

SCL / SDA on Scope. Below Observations.

With AMS5812 Sensor, Peak is curved.

Yellow is SDA and Violet is SCL

SDS00005_withAMS5812_I2CBus.png

Without AMS5812 Sensor. I2C Scanner works fine.

SDS00001_WithoutAMS5812_I2CBus.png