Skip to main content
Visitor II
April 27, 2020
Question

How to initialize the MEMS about ASM300LHH?

  • April 27, 2020
  • 1 reply
  • 1398 views

Hi

I have read the example code, it's a simple initialiation sequence. Is there a specific operation process document or code?

Another questionn,How to calculate the accelerometer offset registers? It's not used in example code.

Best regards�?

    This topic has been closed for replies.

    1 reply

    ST Employee
    April 27, 2020

    Hi @JQiu.1​ , about your questions:

    >> Is there a specific operation process document or code?

    I suggest you to check the application note AN5296, p.18, where the startup sequence in terms of register values to be written is described. Moreover, there are some online available C examples and drivers on the Github repository: here the LINK for ASM330LHH device.

    >> How to calculate the accelerometer offset register?

    The register is described in the AN5296, p.21:

    4.6 Accelerometer offset registers

    The device provides accelerometer offset registers (X_OFS_USR, Y_OFS_USR, Z_OFS_USR) which can be used for zero-g offset correction or, in general, to apply an offset to the accelerometer output data. The accelerometer offset block can be enabled by setting the USR_OFF_ON_OUT bit of the CTRL7_G register. The offset value set in the offset registers is internally subtracted from the measured acceleration value for the respective axis; internally processed data are then sent to the accelerometer output register and to the FIFO (if enabled).

    These register values are expressed as an 8-bit word in two’s complement and must be in the range [-127, 127].

    The weight [g/LSB] to be applied to the offset register values is independent of the accelerometer selected full scale and can be configured using the USR_OFF_W bit of the CTRL6_C register:

    • 2-10 g/LSB if the USR_OFF_W bit is set to 0;
    • 2 -6 g/LSB if the USR_OFF_W bit is set to 1. 

    Regards

    JQiu.1Author
    Visitor II
    April 28, 2020

    Hi Eleon BORLINI:

    Thanks for your reply to my question�?

    >> How to calculate the accelerometer offset register?

    According to the AN5296,​I could set the accelerometer offset registers (X_OFS_USR, Y_OFS_USR, Z_OFS_USR) .

    I hope to know how to calculate the offset value.

    Best regards!

    ST Employee
    April 28, 2020

    Hi @JQiu.1​ , to calculate the offset you can simply read the dataout in a steady state condition for the 3 axis, or, better, you could take an average of these steady conditions. For example, place the ASM300LHH device planar along X and Y (Z axis perpendicular to the floor), read the dataout (that should be near to 0 mg), store it and place the device planar along X and Z, then store the X and Z offset. The offset value along X can be an average between the two tested positions, and similar way for the other two axis, Y and Z. Be aware that a first offset compensation has already been performed during production line calibration, but an additional offset can be present on your device due to the soldering, the broad / substrate bending, the working temperature, etc... It's usually suggested to the customer to optimize the offset according to his/her application. Regards