MorbidJokes
New member
Hello, I'm using the NXP Precision 9DOF FXOS8700 + FXAS21002 board with a teensy 4.0 but I've run into problems using the NXPMotionSenseLibrary.
I'll preface this by saying that I can successfully receive the raw data using the respective Adafruit FXOS8700 and FXAS21002 libraries so I must be doing something right.
Anyway, when attempting to run any of the example scripts that come with the library I receive a "config error FXOS8700" message in the serial monitor. I'm an idiot when it comes to debugging but I found this section of the library code that should be responsible.
bool NXPMotionSense::FXOS8700_begin()
{
const uint8_t i2c_addr=FXOS8700_I2C_ADDR0;
uint8_t b;
//Serial.println("FXOS8700_begin");
// detect if chip is present
if (!read_regs(i2c_addr, FXOS8700_WHO_AM_I, &b, 1)) return false;
//Serial.printf("FXOS8700 ID = %02X\n", b);
if (b != 0xC7) return false;
// place into standby mode
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0)) return false;
// configure magnetometer
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG1, 0x1F)) return false;
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG2, 0x20)) return false;
// configure accelerometer
if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x01)) return false; // 4G range
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG2, 0x02)) return false; // hires
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0x15)) return false; // 100Hz A+M
//Serial.println("FXOS8700 Configured");
return true;
}
The config error message is triggered when one of the above statements returns false, but this is as far as I can get because I have no idea what I'm looking at, can anyone point me in the right direction?
I'll preface this by saying that I can successfully receive the raw data using the respective Adafruit FXOS8700 and FXAS21002 libraries so I must be doing something right.
Anyway, when attempting to run any of the example scripts that come with the library I receive a "config error FXOS8700" message in the serial monitor. I'm an idiot when it comes to debugging but I found this section of the library code that should be responsible.
bool NXPMotionSense::FXOS8700_begin()
{
const uint8_t i2c_addr=FXOS8700_I2C_ADDR0;
uint8_t b;
//Serial.println("FXOS8700_begin");
// detect if chip is present
if (!read_regs(i2c_addr, FXOS8700_WHO_AM_I, &b, 1)) return false;
//Serial.printf("FXOS8700 ID = %02X\n", b);
if (b != 0xC7) return false;
// place into standby mode
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0)) return false;
// configure magnetometer
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG1, 0x1F)) return false;
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG2, 0x20)) return false;
// configure accelerometer
if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x01)) return false; // 4G range
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG2, 0x02)) return false; // hires
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0x15)) return false; // 100Hz A+M
//Serial.println("FXOS8700 Configured");
return true;
}
The config error message is triggered when one of the above statements returns false, but this is as far as I can get because I have no idea what I'm looking at, can anyone point me in the right direction?