cancel
Showing results for 
Search instead for 
Did you mean: 

write a config to STEVAL-MKI220V1 (sensor = LPS27HHTW) with address 0x5C, but 0x5D also gets it

Wai Siang
Associate III

Hi all,
I have two STEVAL-MKI220V1 sharing the I2C1.
Days ago, I had one kit working with Nucleo-767, so now I added another STEVAL-MKI220V1.

After wiring up the kit2, I cloned all the code snippets of kit1 and rename it for kit2 with a number '2' as the suffix of all the variables.
Then I added the write config lines as follows: (also changed that the Psense1_ADD = 0x5C (Gnd), Psense2_ADD = 0x5D (VCC))
ret_hal = HAL_I2C_Mem_Write_IT(&hi2c1 ,Psense1_ADD,Psense1_REG_CRG1,I2C_MEMADD_SIZE_8BIT,Psense1_CReg1W,1); // 1Hz reading of Pressure
ret_hal = HAL_I2C_Mem_Write_IT(&hi2c1 ,Psense2_ADD,Psense2_REG_CRG1,I2C_MEMADD_SIZE_8BIT,Psense2_CReg1W,1);

With these 2 lines, the kit2 doesn't work. The text box of my HMI shows blank.
If I commented either one of it, as follows: (emphasize, "commented either one line")
ret_hal = HAL_I2C_Mem_Write_IT(&hi2c1 ,Psense1_ADD,Psense1_REG_CRG1,I2C_MEMADD_SIZE_8BIT,Psense1_CReg1W,1); // 1Hz reading of Pressure
//ret_hal = HAL_I2C_Mem_Write_IT(&hi2c1 ,Psense2_ADD,Psense2_REG_CRG1,I2C_MEMADD_SIZE_8BIT,Psense2_CReg1W,1);

Then both sensors start to work, and I can see their pressure changes when I tap top of each sensors and see it changes the value in two different text box.

The wiring for address pins are correct. 
Why is this happening, the start-up configuration of kit 1 also enters kit 2 even though the sensor addresses are different?

Does anyone can provide some hints for me to check up?

1 ACCEPTED SOLUTION

Accepted Solutions
Wai Siang
Associate III

I put a HAL_Delay(100) between two I2C command lines and it solved the problem....
(-_-)

View solution in original post

1 REPLY 1
Wai Siang
Associate III

I put a HAL_Delay(100) between two I2C command lines and it solved the problem....
(-_-)