Hi,
I am trying to test the ICM42670 sensor using nRF9160 with Zephyr V2.6.0 and I am getting an errors when I init the sensor:
unexpected RESET_DONE_INT value, 0
ICM42670 Sensor is not ready
device tree:
&spi3 { compatible = "nordic,nrf-spi"; pinctrl-0 = <&spi3_default>; pinctrl-1 = <&spi3_sleep>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; status = "okay"; overrun-character = <1>; // IMU Sensor icm42670: icm42670@0 { compatible = "invensense,icm42670"; reg = <0>; spi-max-frequency = <DT_FREQ_M(24)>; accel-hz = <1600>; accel-fs = <16>; gyro-hz = <1600>; gyro-fs = <2000>; }; };
icm_sensor.c file
const struct device *const icm_dev = DEVICE_DT_GET_ANY(invensense_icm42670); int icm_init(void) { if (icm_dev == NULL) { LOG_ERR("ICM42670 Sensor Not found"); return INIT_ERR; } if (!device_is_ready(icm_dev)) { LOG_ERR("ICM42670 Sensor is not ready"); return INIT_ERR; } LOG_INF("Sensor %s is ready", icm_dev->name); k_sleep(K_MSEC(1000)); return INIT_OK; } void get_icm_data(void) { static unsigned int count; struct sensor_value accel[3]; const char *overrun = ""; int rc = sensor_sample_fetch(icm_dev); ++count; if (rc == -EBADMSG) { /* Sample overrun. Ignore in polled mode. */ if (IS_ENABLED(CONFIG_ICM42670_TRIGGER)) { overrun = "[OVERRUN] "; } rc = 0; } if (rc == 0) { rc = sensor_channel_get(icm_dev, SENSOR_CHAN_ACCEL_XYZ, accel); } if (rc < 0) { LOG_ERR("ICM42670: Update failed: %d", rc); } else { LOG_INF("ICM42670 : X = %f , Y = %f , Z = %f", sensor_value_to_double(&accel[0]), sensor_value_to_double(&accel[1]), sensor_value_to_double(&accel[2])); } }