ICM-20602 power problem

By cvickerpurdueedu , 16 August 2021

Hello I am trying to read the acceleration register from the ICM-20602. I am able to read the who_am_i register and set the power 1 and power 2 registers to 0x01 and 0x3F respectively. I have also read back the power 1 and power 2 registers to confirm they are set correctly. When I go to read any of the acceleration or temperature resisters I get back 0x7F. Attached is my code. It seems the sensor is not turned on. Do I need to do anything else to power up the 20602 other than setting power 1 and 2? Thanks!


#include <SPI.h>  // include the SPI library:

const int slaveSelectPin = 10;
SPISettings settingsA(200000, MSBFIRST, SPI_MODE3);

void setup() {
pinMode (slaveSelectPin, OUTPUT);
SPI.begin();
Serial.begin(115200);
}

void loop() {
SPI.beginTransaction(settingsA);
digitalWrite(slaveSelectPin,LOW);

SPI.transfer(0x6B);//write power 1
SPI.transfer(0x01);//turnon select pll if ready
digitalWrite(slaveSelectPin,HIGH);

digitalWrite(slaveSelectPin,LOW);
SPI.transfer(0x6C);//write power 2
SPI.transfer(0x3F);// turn on all sensors
digitalWrite(slaveSelectPin,HIGH);

digitalWrite(slaveSelectPin,LOW);
SPI.transfer(0xBB);//Read X High byte
int x_H = SPI.transfer(0xFF);
digitalWrite(slaveSelectPin,HIGH);

SPI.endTransaction();

Serial.println(x_H);

delay(100);
}

phpbb Topic ID
39182