2024-11-21 03:20 AM
I need to calibrate a VL53L4CX and have been reading UM2923. The functions described do not seem to bear any obvious relationship to the functions in the STM32Cube middleware which was generated for my project, which I find confusing. I it is not clear which functions I should be calling in order to satisfy the flow charts in UM2923. I have found essentially no other useful information about this device or its specific set of registers. I'm usually a huge fan of ST devices and documentation...
The first sticking point is how to properly understand what to do with calibration settings. Am I supposed to store them in my own flash somewhere? That seems to be implied by UM2923. I can do this, but imagined the device would have its own NVM storage on board, since it is calibrated in the factory anyway. Is this the case? I thought so because the wrapper function VL53L4A2_RANGING_SENSOR_OffsetCalibration() ends by writing a data structure over the I2C interface from a function called VL53LX_set_customer_nvm_managed(). This function only updates a data structure with NVM in its name, but does not actually store anything in NVM. I have not found any APIs which indicate that they update the NVM on the device itself.
The second question is about the content of the calibration data. UM2923 says after each calibration section that it is better to call VL53LX_GetCalibrationData(), modify specific named fields, and then call VL53LX_SetCalibrationData(). Is this still necessary if I perform all three of the calibration steps? I imagine in this case that the data fetched by VL53LX_GetCalibrationData() would be exactly the data to use for VL53LX_SetCalibrationData(). Does the data structure contain other values which change at runtime and are not in fact calibrations?