Go Down

Topic: i2c issues with adafruit FXOS8700+FXAS21002 (Read 124 times) previous topic - next topic

moorbo

Hi there, for a motion sensing project I've been working on, I bought myself the above mentioned sensor and an ESP8266. I have plans to use several PWM, and the ESP8266 only seems to have software PWM and only three channels.

So I moved to an arduino due as my new platform (I have a few laying around) and attemped to use the sensor with it. However, I can never get the i2c to connect, I only get an error (depending on sketch) that the device isnt connected.

If I switch the wires back to the ESP it works perfectly fine. However, back to the due, no go.

Infact this isnt the only motion sensor that doesnt seem to work correct through i2c...my sparkfun LSM9DOS1 also only randomly works through i2c. requiring a full power cycle of the due.

I have tried i2cscannner on the due, which reports the device.


I2C Scanner
Scanning...
I2C device found at address 0x1E  !
I2C device found at address 0x1F  !
I2C device found at address 0x21  !
I2C device found at address 0x6B  !
done

(the results of i2cscanner with both boards on the bus)

Is there something I'm missing? Should I need pullups? I thought with the sda0 scl0 pins they are built in. I posted on the adafruit forums, to only to get a single reply

 'ahh more issues with due i2c, post on the arduino forums'

The sketches I have been running are just the adafruit and the sparkfun example sketches.

I'm at a loss on what to do and I appreciate the help!

thanks in advance!

SurferTim

The ESP8266 is a 5 volt device. The Due is a 3.3 volt device. I use the Due with 5 volt I2C devices, but I use a I2C level shifter.
https://www.adafruit.com/product/757?gclid=CjwKCAjw_47YBRBxEiwAYuKdw5bmCz5IQsClq9dhv9I7QOaid34DLBSjk9OGBO66O6Qfv5w7YxTryhoCwPoQAvD_BwE

moorbo

#2
May 22, 2018, 04:03 pm Last Edit: May 22, 2018, 04:04 pm by moorbo
Ahh sorry, maybe I should have mentioned that...I'm using the adafruit huzzah ESP8266, both sensors work wonderfully without issue on this board through i2c. Unfortunately not on the due :(

https://www.adafruit.com/product/2821

the feather huzzah ESP8266 is a 3v3 device.


https://www.sparkfun.com/products/13284
This is the LSM9DS1 I'm using, which is also 3v3

https://www.adafruit.com/product/3463
the NXP, also a 3v3 board, although it does have a voltage regulator from 5v to 3v3.

I do have a i2c 5v <-> 3v3 however, but I'm not sure the voltage supply is the issue, everything I have is rated for 3v3.


Thanks though for the suggestion :)

Koepel

#3
May 23, 2018, 12:22 am Last Edit: May 23, 2018, 12:47 am by Koepel
When everything is 3.3 V it should be okay. A level shifter makes the I2C bus signals weaker. A double level shifter is terrible.
Since the Adafruit 9DOF module has already a onboard level shifter, you would get:
Arduino Due with 3.3 V signals <---> level shifter 3.3V to 3.3V <---> level shifter 3.3V to 3.3V <---> sensor chip.
That is terrible. The low level has to pass via two internal diodes of the mosfets, I think that will not work.

The Arduino Due has pullup resistors at SDA and SCL of 1k5 to 3.3 V. They should have chosen 4k7 or 10k, I think the 1k5 is a mistake.
Some say that the resistors near pin 20 and 21 have the label "102", that means they are 1k which would be even more stupid. Can you check the resistors ? what does it say ?

I don't know the internal pullup resistor for the SDA and SCL, let's assume they are 100k.
When both sensors are connected, the current to pull a signal low: 3.3 V / ( 100k // 1k5 // 10k // 5k ) = 3.2 mA. The maximum pulldown current is specified as 3 mA for the I2C bus. That means your I2C bus is not according to the official I2C specifications. It is even worse then that, because the sensors on the Adafruit module have to pull that current through the level shifter that is on the module.

Can you try the Due Wire1 bus ? The SDA1 and SCL1 pins are near the USB connector and do not have pullup resistors. Since both the Sparkfun 9Dof IMU and the Adafruit 9-DOF module have already 10k pullup resistors, that should be enough for short wires. Use "Wire1" in the sketch and libraries instead of "Wire", I hope that works.

Be sure to use the newest Arduino IDE version 1.8.5 (or newer, I think there is a 1.8.6 in the Windows Store and a 1.9.0 beta). The Wire library for the Due had a few bugs in the past, and maybe it has still a few more at this moment.

The "Adafruit Precision NXP 9-DOF Breakout Board - FXOS8700 + FXAS21002" has level shifters with 10k resistors on the high side and the low side. That means it has already 5k pullup for SCL and SDA.

The Arduino Uno has special (slow) hardware for I2C with filters, I think that the ESP uses a software I2C library and the Arduino Due has fancy (fast) hardware and probably no filter. It is therefor possible that not every sensor will work in the same way with those boards and even the Adafruit library for the sensor might have influence.

Long story, but you get the idea ;)

twbrkfd1

hey moorbo,
Are you getting good consistent mag data from the FXOS8700 over I2C?

There is an errata sheet from 2015 which states the devices has timing issues and intermittent corrupt mag data when the I2C interface is active at the same time as the Analog Front End!

I see no way around the AFE/I2C issue?

thanks

Go Up