iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.12k stars 1.47k forks source link

I2C devices not working on Omnibus F4 pro #1877

Closed saswatahira closed 7 years ago

saswatahira commented 7 years ago

Yesterday I got an omnibus f4 pro board from AliExpress. I tried to add external compass and GPS module (HMC5883L and Ublox Neo6M). fortunately the GPS is detected after connecting to the UART6, but the compass is not being detected after connecting to the UART3/I2C port and enabling serial RX on UART3. In fact, no external I2C device is detected on the I2C bus. I tried an external barometer and an external mpu6500 gyro (both different from internal sensors). There is 3.3v power in the I2C. Can anyone please help?

DzikuVx commented 7 years ago

If this is Omnibus F4 Pro v3 then this board is not fully supported. @jflyper you seems to have one of those v3 boards...

jflyper commented 7 years ago

@saswatahira For I2C on J10 to work, you must disable everything on UART3; I2C and UART3 share pins, and as soon as something is enabled for UART3, I2C will be disabled.

saswatahira commented 7 years ago

Mine is omnibus f4 pro V2. I have not enabled UART3. I know they have shared pins. But how to use I2C only? Can I do it from CLI or do I have to compile the source code with disabled UART3 pins? I don't have any clear idea. Can someone please guide?

DzikuVx commented 7 years ago

@saswatahira in that case I suspect hardware problems on your side. I can confirm Omnibus F4 Pro v2 working with I2C as long as UART3 is not enabled in Configurator

saswatahira commented 7 years ago

img_20170712_012504_hdr img_20170712_012423_hdr img_20170712_012522_hdr First I tested a gy-86 sensor board with Arduino and multiwii, then connect the VCC, GND, SCL, SDA to the respective pins and enable the serial RX on UART 3 as seen in the photos. Am I doing anything wrong? Or is the board defective? Oh, by the way, GPS was working fine with UART 6, I disconnected it before testing, so the photo might show GPS in red colour.

jflyper commented 7 years ago

You have serial RX enabled on UART3. Disable it.

saswatahira commented 7 years ago

sorry for the screenshot with the UART3 serial RX enabled. anyway, I was experimenting with multiple options. Problem was solved, seemed the Omnibus board and the sensor board both were OK, but the on-board mag sensor on the GPS module did not have some resistors on the output line. Testing with a single HMC5883L breakout board solved the problem. it had all the pull up resistors in the output line.

So in conclusion, iNav is OK, Omnibus F4 pro V2 is OK. the Compass with GPS board was partially faulty, which can be corrected by adding two resistors on the SCL and SDA pins to VCC. So, in my opinion this issue can be closed.

screen

saswatahira commented 7 years ago

img_20170712_134303

Well I solved the issue by adding two 1K resistors between VCC to SCL and VCC to SDA. It works now.

DzikuVx commented 7 years ago

So I assume we can close it, right?

FlyingGustel commented 7 years ago

I can confirm this fix. It worked for my Omnibus F4 Pro + ublox m8n with HMC 5883.

yellowpanther commented 7 years ago

@saswatahira you saved my day (and money ;))

Worked with this GPS unit (with HMC5883 mag) and my Omnibus F4 Pro (v3) : image

Pokornz commented 6 years ago

@saswatahira So even though the voltage on the line is 3.3V (you say that in the first post), you had to add 1k pullup resistors?

jflyper commented 6 years ago

It is not only the voltage, but how fast the bus can recover the voltage from low state (driven by devices) to hi state (idle state). Larger (weaker) pull-up resistors make it slower, smaller (stronger) ones make it faster.

On the contrary, stronger pull-ups makes devices harder to drive the bus low, while weaker ones make it easier. Think of the case that the bus is tied to 3V3 supply (strongest pull-up); it could never be driven low.

The best value varies from system to system, as it also depends on wire capacitance and inductance, but I suggest that synthesized pull-up resistor value to be around R2.2K.

Ref: http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors

PScott1 commented 6 years ago

@saswatahira. Thanks I have the same older style M6 GPS/mag board (CJMCU-APM) and was scratching my head why I couldn't get a i2c connection. @jflyper thanks for explaining about the pull up resistor. I had no idea.

asmeureanu commented 6 years ago

@yellowpanther what resistors did you solder and where is best to do it? I am in the same situation as you were.

yellowpanther commented 6 years ago

@asmeureanu I soldered 1k resistors between sda and vcc, and scl and vcc. I don't know where is the best to do it, but I did it direcly on the wires, with standard resistors (not smd) and it worked.

rholt51 commented 6 years ago

i'm surprised how LONG it took me to find this fix (which worked!, btw). i'm very happy and i'm giving myself some kudos for searching as long as i did to find this thread. i made perfect sense to me and i was encouraged by the people who tried this and succeeded. i, too, succeeded. thanks so much for the help on this. right now i have 1/4watt resistors 'cause that's all i had lying around, but i will be ordering some tiny 1k's tonight. Russ from Coral Springs, Floriday, USA

tropnevad commented 6 years ago

Have you tried to use resource mapping, as the omnibus boards (and many other FC) use configurable I2C ports so you need to map them using CLI

In the case of Omnibus F4 the following should help..

resource i2c_scl 2 b10
resource i2c_sda 2 b11
DzikuVx commented 6 years ago

@tropnevad there is no resource mapping in INAV

simtcrom commented 6 years ago

I am using a Readytosky Ublox NEO-M8N GPS Module w/ Built-in HMC5883L. My FC is Omnibus f4 pro v2. Initially the compass was not being detected correctly and I had reduced i2c speed to 200KHZ. That made compass detected. But during flight, it constantly stop functioning (blackbox logs). And I think, it is due to this pull up resistor issue. I have drawn a wiring picture can some one please confirm if the way resistors to be connected are correct? compass_issue_wiring

digitalentity commented 6 years ago

Are you sure that GPS module doesn't have it's own 3.3V regulator?

simtcrom commented 6 years ago

I dont know that for sure. I am attaching a photo of my GPS module inside. Could you please check? img_9270

simtcrom commented 6 years ago

I am all set adding pull up resistors

teckel12 commented 6 years ago

Sounds like this is not an INAV issue, more like a Chinese clone issue due to lack of "unneeded" pull-up resistors.

yo8aiv commented 5 years ago

20190603_221752 gps2 2kmag

thanks for posting sollutions guys. mag issue solved by adding 2 pullup resistors (2.2k) to 3.3v inside gps

tijira-1999 commented 4 years ago

I am all set adding pull up resistors

Could you please show your connection diagram

tijira-1999 commented 4 years ago

I am all set adding pull up resistors

I have the exact same gps module please show your wiring diagram

Are you using 5v as VCC or 3.3v??