Teensy 4.0 NXPMotionSense Config Error

Status
Not open for further replies.

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?
 
First run File > Examples > Wire > Scanner to check which I2C devices are really connected and what addresses they are actually using.
 
First run File > Examples > Wire > Scanner to check which I2C devices are really connected and what addresses they are actually using.

This is the serial output of the script. I assume the unknown chip is the IMU.


Scanning...

Device found at address 0x1F (unknown chip)

Device found at address 0x21 (MCP23017,MCP23008,PCF8574)

done


I hope this helps.
 
It found a chip with address 0x1F. From within the library:

Code:
#define FXOS8700_I2C_ADDR0           0x1E // SA1 = Gnd, SA0 = Gnd
#define FXOS8700_I2C_ADDR1           0x1D // SA1 = Gnd, SA0 = Vcc
#define FXOS8700_I2C_ADDR2           0x1C // SA1 = Vcc, SA0 = Gnd
#define FXOS8700_I2C_ADDR3           0x1F // SA1 = Vcc, SA0 = Vcc

But the code you're running has this:

Code:
const uint8_t i2c_addr=FXOS8700_I2C_ADDR0;

So at the very least, you can see the library designed for the FXOS8700 to use address 0x1E, but on this board you've purchased it's connected at 0x1F.
 
It found a chip with address 0x1F. From within the library:

Code:
#define FXOS8700_I2C_ADDR0           0x1E // SA1 = Gnd, SA0 = Gnd
#define FXOS8700_I2C_ADDR1           0x1D // SA1 = Gnd, SA0 = Vcc
#define FXOS8700_I2C_ADDR2           0x1C // SA1 = Vcc, SA0 = Gnd
#define FXOS8700_I2C_ADDR3           0x1F // SA1 = Vcc, SA0 = Vcc

But the code you're running has this:

Code:
const uint8_t i2c_addr=FXOS8700_I2C_ADDR0;

So at the very least, you can see the library designed for the FXOS8700 to use address 0x1E, but on this board you've purchased it's connected at 0x1F.

Okay, I think we've made progress.

I changed the library file so that it points to FXOS8700_I2C_ADDR3 instead of FXOS8700_I2C_ADDR0 and that bit works. I also did the same for the FXAS21002 and neither throw errors. However, I now have the same issue with the MPL3115. The serial monitor shows "config error MPL3115" but there is no alternative address to point to, so I'm stuck again.

But it's still progress, thank you.
 
Status
Not open for further replies.
Back
Top