Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvenSense ICM20649 IMU driver #14318

Merged
merged 1 commit into from
Apr 21, 2020
Merged

InvenSense ICM20649 IMU driver #14318

merged 1 commit into from
Apr 21, 2020

Conversation

dagar
Copy link
Member

@dagar dagar commented Mar 7, 2020

This is a driver for the InvenSense ICM20649 in the style of the "new" InvenSense drivers that use FIFOs and grab all raw data. This device is a bit different than some of the older sensors (icm20602, mpu6000, etc) as it has multiple register banks and a 32G dynamic range.

This will need a little bit more effort with actual hardware before it actually works.

TODO:

@dagar
Copy link
Member Author

dagar commented Apr 21, 2020

This is now working, other than the data ready interrupt which is behaving oddly. The data ready interrupt interval is only updating every ~ 153 us. If the FIFO_CFG reset is set we get the expected 111.11 us (9000 Hz ODR), but the FIFO seems to only contain gyro data. I'll leave it disabled for now, it still works well without it.

nsh> icm20649 status
INFO  [SPI_I2C] Running on SPI Bus 6
INFO  [icm20649] FIFO empty interval: 1111 us (900.000 Hz)
icm20649: transfer: 522795 events, 239973725us elapsed, 459.02us avg, min 242us max 775us 67.273us rms
icm20649: bad register: 0 events
icm20649: bad transfer: 0 events
icm20649: FIFO empty: 15 events
icm20649: FIFO overflow: 3 events
icm20649: FIFO reset: 4 events
icm20649: DRDY interval: 0 events, 0.00us avg, min 0us max 0us 0.000us rms
INFO  [drivers_accelerometer] /dev/accel device instance: 2
INFO  [drivers_accelerometer] calibration scale: 1.00000 1.00000 1.00000
INFO  [drivers_accelerometer] calibration offset: 0.00000 0.00000 0.00000
INFO  [drivers_gyroscope] /dev/gyro device instance: 2
INFO  [drivers_gyroscope] calibration offset: 0.00000 0.00000 0.00000
nsh> listener sensor_accel_fifo -i 1

TOPIC: sensor_accel_fifo instance 1 #1
 sensor_accel_fifo_s
        timestamp: 593949642  (0.000412 seconds ago)
        timestamp_sample: 593949170
        device_id: 2424882 (Type: 0x25, SPI:6 (0x00)) 
        dt: 222.0000
        scale: 0.0095
        x: [-19, -15, -12, -19, -17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        y: [9, 7, 10, -5, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        z: [-1039, -1043, -1038, -1036, -1058, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        samples: 5
nsh> listener sensor_gyro_fifo -i 1

TOPIC: sensor_gyro_fifo instance 1 #1
 sensor_gyro_fifo_s
        timestamp: 635173303  (0.000321 seconds ago)
        timestamp_sample: 635172828
        device_id: 2424882 (Type: 0x25, SPI:6 (0x00)) 
        dt: 111.0000
        scale: 0.0021
        x: [3, -17, 19, -10, -13, 1, -5, -10, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        y: [-6, -13, 4, -21, 9, 1, -27, -6, 9, -28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        z: [5, 1, 16, 23, -9, -9, 10, 21, 2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        samples: 10

@dagar dagar marked this pull request as ready for review April 21, 2020 14:23
@dagar dagar changed the title [WIP] initial InvenSense ICM20649 driver InvenSense ICM20649 IMU driver Apr 21, 2020
@dagar
Copy link
Member Author

dagar commented Apr 21, 2020

This isn't currently used by any boards in tree, so it's harmless to merge.

@dagar dagar merged commit c5eefc6 into master Apr 21, 2020
@dagar dagar deleted the pr-icm20649 branch April 21, 2020 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant