Cannot communicate with FXOS8700CQ sensor over I2C

usinjin
Posts: 6
Joined: Wed Aug 30, 2017 6:13 am

Cannot communicate with FXOS8700CQ sensor over I2C

Postby usinjin » Mon Nov 27, 2017 9:43 pm

Hello all,

I'm fairly new to working with I2C, so bear with me if I am a little slow in figuring things out.

I have an ESP-32S WROOM32 module and I'm trying to read accelerometer/magnetometer values from a FXOS8700CQ. The sensor is on the The NXP Precision 9DoF breakout board (from Adafruit). I added 2 pullup resistors (9k) to the SCL and SDA lines. The example code for reading the FXOS8700CQ sensor from an Arduino works nicely. Previously I had been using a ADXL345 sensor connected in the exact same manner to the ESP and it worked perfectly. I tried to adapt that code to work with the FXOS8700CQ, and that's where I'm stuck. Somehow, when I write the address of the FXOS8700CQ to the bus for the first time (sensors.c, in the initACC() function, attempting to set up the sensor range, power state, etc), it's incorrect or somehow the sensor was not initiated properly. I don't think the address is wrong, but I'm not sure what is. What am I doing wrong?
Attachments
esp32_i2c_fxoS8700_fxas21001_main.c
(1.06 KiB) Downloaded 968 times
sensors.h
(4.64 KiB) Downloaded 904 times
i2c.h
(1.04 KiB) Downloaded 931 times

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Cannot communicate with FXOS8700CQ sensor over I2C

Postby kolban » Sun Mar 11, 2018 12:29 am

When trying to solve I2C based puzzles, I can't work without a $10 logic analyzer connected to my PC. This allows me to sense the data and clock lines and get a visualization of what is happening under the covers. I'd recommend plugging one of those into your story and examining the results.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 41 guests