Skip to main content
Visitor II
November 29, 2018
Question

I2C sensor read issue if read continuously in an infinite loop.

  • November 29, 2018
  • 1 reply
  • 1018 views

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

    This topic has been closed for replies.

    1 reply

    Visitor II
    November 30, 2018

    Solved the issue by doing i2c read using interrupt instead of polling.