Skip to main content
NAsma.1
Associate II
May 20, 2022
Question

Hi, am working with iks01A1 expansion board (specifically LMS6DS0 sensor) and i need to change the Output data rate, could someone please tell me how ? thank you.

  • May 20, 2022
  • 3 replies
  • 858 views

..

    This topic has been closed for replies.

    3 replies

    Eleon BORLINI
    ST Employee
    May 27, 2022

    Hi @NAsma.1​ ,

    A fast solution could be use the Unicleo-GUI for the IKS01A1 interface and to change the ODR settings there..

    For a code-level interaction with the LSM6DS0 device, unfortunately, the X-NUCLEO-IKS01A1 is no longer support by ST. However, you can try to use the X-CUBE-MEMS1 package, and in particular the examples related to the IKS01A2 and the sensor_commands.c

    **
     * @brief Set sensor output data rate
     * @param Msg the pointer to the message to be handled
     * @retval 1 if the message is correctly handled, 0 otherwise
     */
    static int SC_Set_ODR(TMsg *Msg)
    {
     float odr = 0.0f;
     int ret = 1;
     
     ArrayToFloat(&Msg->Data[5], &odr);
     
     /* Sensor Type */
     switch (Msg->Data[4])
     {
     case SC_ACCELEROMETER:
     if (IKS01A2_MOTION_SENSOR_SetOutputDataRate(AccInstance, MOTION_ACCELERO, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     case SC_GYROSCOPE:
     if (IKS01A2_MOTION_SENSOR_SetOutputDataRate(GyrInstance, MOTION_GYRO, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     case SC_MAGNETOMETER:
     if (IKS01A2_MOTION_SENSOR_SetOutputDataRate(MagInstance, MOTION_MAGNETO, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     case SC_TEMPERATURE:
     if (IKS01A2_ENV_SENSOR_SetOutputDataRate(TmpInstance, ENV_TEMPERATURE, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     case SC_HUMIDITY:
     if (IKS01A2_ENV_SENSOR_SetOutputDataRate(HumInstance, ENV_HUMIDITY, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     case SC_PRESSURE:
     if (IKS01A2_ENV_SENSOR_SetOutputDataRate(PrsInstance, ENV_PRESSURE, odr) != BSP_ERROR_NONE)
     {
     return 0;
     }
     break;
     
     default:
     ret = 0;
     break;
     }

    It is not a plug-and-play solution, it has to be adapted to IKS01A1 devices.

    -Eleon

    NAsma.1
    NAsma.1Author
    Associate II
    May 30, 2022

    Thank you so much,

    NAsma.1
    NAsma.1Author
    Associate II
    May 30, 2022

    Is there any way i can recuperate the tilt angles without using the unicleoGUI, a code-level interaction i mean ( since LSM6DS0 provides acceleration and angular velocity ) ?