2018-11-29 04:35 AM
Hi
I have STM32L073 based custom board with LoRa Module,VL53L1X is interfaced using I2C to the MCU. The function of the board is it will report the sensor reading after every 10s to LoRa gateway. The I2C read works fine initially but after some time I2C read fails continuously. After power reset only it starts working and again it repeats.
#define I2C_TIMING 0x00B1112E
I2cHandle->Instance = ( I2C_TypeDef * )I2C1_BASE;
I2cHandle->Init.Timing = I2C_TIMING;
I2cHandle->Init.OwnAddress1 = I2C_ADDRESS;
I2cHandle->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
I2cHandle->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
I2cHandle->Init.OwnAddress2Masks = I2C_OA2_NOMASK;
I2cHandle->Init.OwnAddress2 = 0xFF;
I2cHandle->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
I2cHandle->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
The I2C timing I am using is 0x00B1112E. I also tried 0x00300F38 this timing both time facing same issue. Is there any fix for this issue? Any configuration change needed for the fix?
Thanks
2018-11-30 01:01 AM
Solved the issue by doing i2c read using interrupt instead of polling.