finani / ICM42688

Arduino library for communicating with the InvenSense ICM42688 nine-axis IMUs.
MIT License
47 stars 21 forks source link

Issue with SPI mode for mikroe-4237 board ( ICM42688-p ) #3

Closed jlja18 closed 1 year ago

jlja18 commented 1 year ago

If you get an error in the simple SPI example on the very first read, change the SPI mode to mode3 in the source code.

plusk01 commented 1 year ago

It seems like the SPI mode should be set as SPI_MODE3 for all masters/boards. Looking at Section 9.6 of the datasheet, data is latched on the rising edge of SCLK, which is either MODE0 or MODE3. Looking at Section 3.5 of the datasheet shows that an inactive clock should be pulled high, which is either MODE2 or MODE3. Therefore, SPI_MODE3 is the appropriate choice.

image

See the following for more info on SPI modes: https://www.corelis.com/education/tutorials/spi-tutorial/

image

tested on esp32

finani commented 1 year ago

Thank you for the issues and the reply. I tested the repo with teensy 4.0. So, It would be a little different at other boards.