iNavFlight / inav

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

No external mag detection on NAZE32 Rev6 7DOF #594

Closed jstremmler closed 7 years ago

jstremmler commented 8 years ago

When I install iNav 1.2.0 stable on a Naze Rev6 7DOF, ( e.g. this one: https://www.aliexpress.com/item/New-Arrival-REV6-NAZE32-7DF-Flight-Controller-For-RC-Multirotors-Baseflight-Configurator/32596170179.html?spm=2114.01010208.3.1.23mz9A&ws_ab_test=searchweb201556_0,searchweb201602_1_10065_10068_112_10069_110_111_10017_109_108_10060_10061_10062_10057_10056_10055_10037_10054_301_10033_10059_10032_10058_10073_10070_10052_10053_10050_10051,searchweb201603_3&btsid=a1c262fc-710c-4580-8969-2101bcbb86b0 ) which has a barometer BMP 280 but no magnetometer installed an external magnetometer sitting in my GPS is no longer recognized.

Is there any reason why the external mag is not shown anymore?

My own compiled NAZE.hex file (RC4) from 08.28.2016 shows my external magnetometer HMC5883 correctly.....

jflyper commented 7 years ago

@giacomo892 Thanks!

jstremmler commented 7 years ago

Ok finally I applied revert 0f63bc6 with iNav 1.2.1 and it works! Here is my status and bootlog: screenshot - 01_10

digitalentity commented 7 years ago

@jstremmler what did your log look like before the revert?

jstremmler commented 7 years ago

@digitalentity: Here ist the status and bootlog right after flashing downloaded iNAV 1.2.1. NAZE.hex file from github: screenshot - 02_10

digitalentity commented 7 years ago

@jstremmler very interesting. Looks like 0f63bc68575f3ff03e5db5819f8e815545b334ea has nothing to do with the issue. It's mag detection that fails and that commit has nothing to do with detection - it only affects MAG init. Something to think about. Can you also try the latest "development" branch?

stronnag commented 7 years ago

Ho hum, development: https://github.com/iNavFlight/inav/pull/624#event-797558017. Interesting to see what happens here.

jflyper commented 7 years ago

@stronnag Yeah, I mentioned it. But it only shows correct number of I2CErrors...

digitalentity commented 7 years ago

I think it's somehow related to busy-loop delays in I2C driver. We need to change them to use proper timings instead of arbitrary empty loops that might be optimised out by the compiler.

jstremmler commented 7 years ago

I just cloned the iNav.git file again because I had modified files compass_hmc5883l.c, logging_codes.h and logging.c before. Next I compiled NAZE.hex again and flashed the firmware.... And it worked as well: screenshot - 01_10 So now I have a downloaded NAZE.hex file from github which doesn't detect the magnetometer correctly and a self-compiled one from the actual development which works..... Do we have an explanation??

stronnag commented 7 years ago

And which compiler version are you using?

jstremmler commented 7 years ago

I wrote before: cygwin64, latest version......

stronnag commented 7 years ago

which helps no one .... the actual compiler version please.

arm-none-eabi-gcc --version
jstremmler commented 7 years ago

Version is CYGWIN64 (2.874) Have a look here: https://www.cygwin.com/ and here : https://cygwin.com/ml/cygwin/2016-06/msg00064.html

jflyper commented 7 years ago

When I was investigating the cleanflight/cleanflight#2310, timings for normal cycles were okay, but I became aware of cleanflight/cleanflight#2272 also.

And, was there a build environment change recently? I was forced to download 5.4 toolchain.

stronnag commented 7 years ago

You can use whatever tool chain you like, e.g arm-none-eabi-gcc 6.2.0 works well for me; that was what I was (futility) attempting to determine, as arm-none-eabi-gcc 5.x has not generated good results for me.

jstremmler commented 7 years ago

So, as up to now we have no explanation, let me do a speculation:

Can this be an issue of different compilers by which we produce the hex code???

digitalentity commented 7 years ago

Actually yes. Build 1.2.1 was by my mistake compiled using gcc-5.4.1 which might explain the ill behaviour.

digitalentity commented 7 years ago

@jstremmler can you check the latest development branch? We've made a fix to I2C driver

digitalentity commented 7 years ago

I'm closing this. We don't hear about mag problems for a while now. Feel free to re-open if issue persists.

nipunnawanjana1 commented 6 years ago

it work for me https://youtu.be/9Es1NzxLyWE