2025-02-19 09:54 PM
Dear Team,
We are integrating lsm303AGR accelerometer and magnetometer sensors on NXP's imx8 Android 10 platform.
https://github.com/STMicroelectronics/st-mems-android-linux-sensors-hal for HAL
https://github.com/STMicroelectronics/st-mems-android-linux-drivers-iio for linux 5.4 kernel
device registers as iio:device0 and iio:device1 x,y,z raw value we can see in cat sysfs files.
HAL finds 2 IIO devices but further
there is lack of implementation of loading bias and save bias functions in legacy
because of this the sensors app is not able to read the sensor data values . apps says there are 2 sensors from stm accel and magn but data is not able to read.
it is going into un-calibrated type.
kindly help us in fixing the issue.
2025-02-20 05:35 AM
Hi @prasannakulkarni ,
Can you check if the Linux driver works correctly on your platform?
To verify this, once the sensor is activated, the accelerometer or magnetomer interrupts must increment regularly, otherwise there could be an issue with the configuration of the interrupt lines in the device tree. To see if the interrupts are triggered regularly, you can read the file/proc/interrupts, checking for example if the lsm303agr_accel counter increases.
2025-02-21 06:28 AM
Yes you are true, interrupts are getting incremented. kindly find the attached files there are no implementations for loadbias and savebias in legacy mode
legacy/SensorsLegacyInterface.cpp
/**
247 * onSaveDataRequest: receive data to store,
248 * reference: ISTMSensorsCallbackData class
249 */
250 int SensorsLegacyInterface::onSaveDataRequest(const std::string& resourceID,
251 const void *data, ssize_t len)
252 {
253 (void) resourceID;
254 (void) data;
255 (void) len;
256
257 return -EIO;
258 }
259
260 /**
261 * onLoadDataRequest: load data from disk,
262 * reference: ISTMSensorsCallbackData class
263 */
264 int SensorsLegacyInterface::onLoadDataRequest(const std::string& resourceID,
265 void *data, ssize_t len)
266 {
267 (void) resourceID;
268 (void) data;
269 (void) len;
270
271 return -EIO;
272 }
2025-02-21 06:29 AM
2025-02-21 06:30 AM
2025-02-21 06:30 AM
2025-02-21 06:31 AM
Kindly help