Skip to content

icm20948 incorrect register for gyro DLPF #605

@ydvo

Description

@ydvo

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

What is the expected behavior?

Calling set_gyroscope_dlpf_enabled(true, ec) from icm20948 component enables low pass filter

What is the actual behavior?

Doesn't enable low pass filter and sometimes returns an error.

Steps to reproduce.

Call set_gyroscope_dlpf_enabled(true, ec)

Build or installation Logs.


More Information.

From line 531 of icm20948.cpp:

template <espp::icm20948::Interface I>
bool Icm20948<I>::set_gyroscope_dlpf_enabled(bool enable, std::error_code &ec) {
  std::lock_guard<std::recursive_mutex> lock(base_mutex_);
  // select bank 2
  if (!select_bank(Bank::_2, ec)) {
    return false;
  }
  uint8_t bitmask = 0x01; // enable DLPF is bit 0 in GYRO_CONFIG_1
  set_bits_in_register_by_mask(static_cast<uint8_t>(RegisterBank2::GYRO_CONFIG_2), bitmask,
                               enable ? bitmask : 0, ec);
  return !ec;
}

Both comment and page 59 of datasheet indicate enable bit is is in GYRO_CONFIG_1 register not config_2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions