Adafruit IMC-20948 with SparkFun ICM-20948 Library

Hello!
I'm using the Adafruit IMC-20948 with Arduino Nano. I want to use the GitHub - jremington/ICM_20948-AHRS: Mahony Fusion Filter and Tilt compensated compass for ICM_20948 package which, however, works wit the SparkFun ICM-20948 Arduino Library. If I try to read out raw sensor data with this library I get appropriate data for Acc, Gyro and Temp but the Mag data is always 0.
Is it a initialization problem of the Adafruit sensor with the SparkFun library? Is it possible to modify the library to get it working with the Adafruit sensor?

Thanks and best wishes
Slava

Please post the code, using code tags, and example output.

Hello! Sorry for the delay over the weekend.
I just use the Sketch Example1_Basics.ino from the SparkFun ICM20948 Arduino Library . Probably I don't need to put the code here. And this is the output I get:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5856
entry 0x400806a8
Initialization of the sensor returned: All is well.
Waiting for data
Scaled. Acc (mg) [ 00021.24, 00018.55, 01011.47 ], Gyr (DPS) [ -00000.91, 00001.57, -00000.12 ], Mag (uT) [ 00000.00, 00000.00, 00000.00 ], Tmp (C) [ 00022.76 ]
Scaled. Acc (mg) [ 00025.39, 00018.07, 01010.01 ], Gyr (DPS) [ -00000.86, 00001.23, 00000.03 ], Mag (uT) [ 00000.00, 00000.00, 00000.00 ], Tmp (C) [ 00022.57 ]
Scaled. Acc (mg) [ 00022.22, 00020.75, 01012.70 ], Gyr (DPS) [ -00000.99, 00001.30, -00000.18 ], Mag (uT) [ 00000.00, 00000.00, 00000.00 ], Tmp (C) [ 00022.71 ]
Scaled. Acc (mg) [ 00025.39, 00016.85, 01012.21 ], Gyr (DPS) [ -00001.15, 00001.29, -00000.02 ], Mag (uT) [ 00000.00, 00000.00, 00000.00 ], Tmp (C) [ 00022.76 ]

As you can see I get data from all sensors except the magnetometer.
Best wishes
Slava

Seems like the sensor is defective.

Hello!
No, the sensonsor is not defective. With another library ( GitHub - wollewald/ICM20948_WE: An Arduino library for the ICM20948 9-axis accelerometer, gyroscope and magnetometer. It contains many example sketches with lots of comments to make it easy to use. ) I get all sensor data including the magnetometer. I suspect that probably some rigesters are difined differently but
unfortunately, I'm not able to find out the exact problem.

Hi Slava, it looks like the problem might be with how the library is set up to read the sensor. Since the other library works fine and gives you all the data, try comparing how both libraries set up the sensor. Maybe some settings are different. You can also check if the SparkFun library is correctly initializing the sensor.

Hello, and happy new year. My problem is that I'm not familiar with the structure of libraries. I don't know what should I compare. Probably some registers are defined different way. But in which file should I look for?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.