Skip to content

Reduce or eliminate use of delay() in IMU.init() calls (LSM6DSL) #26

@quicksketch

Description

@quicksketch

Hi @LiquidCGS, thanks for making this library. It's been a big help making my IMU code work across multiple devices.

I'm currently using a LSM6DSL IMU and I'm encountering two issues with it:

  1. I'm initialize the IMU very quickly after booting, and apparently sometimes the device isn't ready yet. The call to readByte(IMUAddress, LSM6DSL_WHO_AM_I) returns nothing. I can fix this problem by adding a delay(500) before calling LSM6DSL::init(). However, this is undesirable since I want a very fast boot time.

  2. When the device does init successfully, LSM6DSL::init() contains its own delay(100) that adds unnecessary waiting and delay. According to the LSM6DSL specifications (page 49), a soft boot call only should take 50 nanoseconds:

The SW_RESET procedure can take 50 μs; the status of reset is signaled by the status of the SW_RESET bit of the CTRL3_C register

What I would like to propose to hopefully solve both problems is that a while() loop be introduced to check if the device is ready, rather than either assuming the device is already ready when init() is called, and then check if the device is ready after executing a soft reset, rather than hard-coding a delay. I'll see about filing a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions