This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr ICM-20948 interface nrf5340

Hi,
I had designed custom board using icm20948. i tried to get raw values from sensor and succeed then i had ported nucleo code for nrf53 zephyr. when i tried to run below code

inv_icm20948_serif_i2c_init(usr_read, usr_write);
/*
* Create icm20948 Device
* Pass to the driver:
* - reference to serial interface object,
* - reference to listener that will catch sensor events,
* - a static buffer for the driver to use as a temporary buffer
* - various driver option
*/
inv_device_icm20948_init(&device_icm20948, &icm20948_serif,
&sensor_listener, dmp3_image, sizeof(dmp3_image));

/*
* Simply get generic device handle from icm20948 Device
*/
device = inv_device_icm20948_get_base(&device_icm20948);

/*
* Just get the whoami
*/
rc = inv_device_whoami(device, &whoami);
printk("ICM WHOAMI=%02x", whoami);
check_rc(rc);

/*
* Check if WHOAMI value corresponds to any value from EXPECTED_WHOAMI array
*/
for(i = 0; i < sizeof(EXPECTED_WHOAMI)/sizeof(EXPECTED_WHOAMI[0]); ++i) {
if(whoami == EXPECTED_WHOAMI[i])
break;
}

if(i == sizeof(EXPECTED_WHOAMI)/sizeof(EXPECTED_WHOAMI[0])) {
printk("Bad WHOAMI value. Got 0x%02x. Expected @EXPECTED_WHOAMI@.", whoami);
check_rc(-1);
}

/*
* Configure and initialize the icm20948 device
*/
printk( "Setting-up ICM device");
rc = inv_device_setup(device);
check_rc(rc);

/*
* Now that Icm20948 device was inialized, we can proceed with DMP image loading
* This step is mandatory as DMP image are not store in non volatile memory
*/
printk("Load DMP3 image");
rc = inv_device_load(device, NULL, dmp3_image, sizeof(dmp3_image), true /* verify */, NULL);
check_rc(rc);

my device run for first time with correct value of inv_device_whoami (). then i2c stop working.

kindly support get run on my custom board. why this happened. my second board also stop working just as first one.

Parents Reply Children
Related