Hi ,
We are using mma8451 in our imx6 custom board.We tried following the instruction given in the below link for the register settings
How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?
But doing the register setting there is fluctuation in the data obtained and we are not able come to one conclusion.
We have done all the setting as mentioned in https://community.nxp.com/docs/DOC-98836
Is there anything we are missing so that the fluctuation in x,y,z data corrected.
Thank you,
Deepanraj.A
The Driver which we are using is in the following path drivers/hwmon/mxc_mma8451.c
Is this driver correct ?
Thank you,
Deepanraj.A
Hi Deepanraj,
Unfortunately I am not familiar with this driver, but I will try to find and look into it. Meanwhile, you may also try to use the i.MX community and ask others.
Best regards,
Tomas
Hi Deepanraj,
It is hard to say where the problem might be. How much do your data fluctuate? Do you have a graph or a table illustrating it? Can you please also share your initialization and conversion routines?
Best regards,
Tomas
The register setting which we have followed are
XYZ_DATA_CFG set as 0x00
CTRL_REG2 set as 0x02
CTRL_REG1 set as 0x3D
The raw x , y and z data which is obtained we convert it to 14-bit data and divide by the sensitivity(4096) since the full scale is 2g as below
x = ((float)(ev[0].value>>2) / 4096)
y = ((float)(ev[1].value>>2) / 4096)
z = ((float)(ev[2].value>>2) / 4096)
The settings and raw data conversion is it proper ?
Hi Deepanraj,
Yes, it appears to be correct. Just confirm that:
ev[0].value = OUT_X_MSB<<8 | OUT_X_LSB
ev[1].value = OUT_Y_MSB<<8 | OUT_Y_LSB
ev[2].value = OUT_Z_MSB<<8 | OUT_Z_LSB
As I asked before, can you please share the dataset showing the fluctuation?
Best regards,
Tomas
Hi Deepanraj,
The dataset you provided is really strange. You may have a defective part. Have you tested several MMA8451Q accelerometers or only one? How do you read the accel data (polling/interrupt)?
Best regards,
Tomas
Hi Tomas,
Is there a way to reduce this fluctuation by setting any of the registers ?
Thank you,
Deepanraj.A
Hi Deepanraj,
Your register settings is correct (LNOISE = 1, MODS[1:0] = 0b11 = High resolution mode, ODR = 1.56Hz). Such a fluctuation, especially on the X and Y-axis, is not a noise. There must be another reason of such a variance, but I am currently not really sure what it might be.
Best regards,
Tomas
Hi Tomas,
We are following polling method and this is the data obtained from evtest application.
We also tested in another board with mma8451 sensor and found the same behavior.
The x and z axis seemed to be somewhat proper after the conversion But Y-Axis value is not proper
Thank you,
Deepanraj.A