tdk-invn-oss / motion.arduino.ICM42670P

Arduino Driver for TDK InvenSense consumer motion sensor ICM42670P
https://invensense.tdk.com/smartmotion
BSD 3-Clause "New" or "Revised" License
32 stars 4 forks source link

Fix Incorrect SPI Mode Initialization in Sensor Driver #9

Closed qifu04 closed 9 months ago

qifu04 commented 10 months ago

This commit addresses an issue where the sensor was not being driven correctly due to an error in the initialization of the SPI mode. As per the sensor datasheet (ICM-42670-P), on Page 45, under the DEVICE_CONFIG register, bit 0 is defined crucial for SPI mode selection. After reset, this register is initialized to 0x40, with the default value of bit 0 set to 0, indicating "SPI mode selection 0: Mode 0 and Mode 3".

The correction made in this commit involves setting the host's SPI mode to either Mode 0 or Mode 3, as per the default configuration of the sensor. This change ensures that the sensor is driven correctly, aligning the driver configuration with the sensor's default state post-reset. This fix is essential for the proper operation of the sensor using SPI communication. image

rbuisson-invn commented 10 months ago

Thanks for spotting that issue! This will be fixed in coming release.

rbuisson-invn commented 9 months ago

The reported issue is fixed in verison 1.0.1. Please update your library version. Thanks