Enabling GPS and magnetometer support on Cleanflight v2.2.0 NAZE32

I have an Eachine Blade 185 and after upgrading to Cleanflight 2.2.0 and having to upgrade to NAZE 2.3.2 I found out that magnetometer and GPS support were gone. Understandable as the Blade does not have a lot of memory and since Cleanflight and NAZE have been adding lots of features, something has to go.

I spend some time trying to play with the settings. Unfortunately there is a lot of bad info on many websites including YouTube and there are not settings that will fix this. You have to rebuild Cleanflight with the correct flags. However, is not that straightforward. The tutorial from Cleanflight here  is not accurate. The GPS will not come back to life with these settings.

If you are still reading and wonder how to get this going, here are the steps:

  • Build Cleanflight according to the instructions here
  • I built on Mac OS so I followed the instructions here
  • Navigate to your Cleanflight installation /cleanflight/src/main/target/NAZE
  • Edit target.h
  • Add the following lines:
    #define USE_MAG
    #define USE_MAG_HMC5883
    #define MAG_HMC5883_ALIGN CW180_DEG

    #define USE_GPS
    #define USE_GPS_NMEA

  • You will need to use the NMEA protocol for these settings. If you want to use UBLOX then change:
    #define USE_GPS_NMEA
    for
    #define USE_GPS_UBLOX
  • Now, because this issue is related to the amount of memory available, to do this you need to disable some functionality or the build will fail. Comment out the following lines and change as need:
    /* only 2 uarts available on the NAZE, add ifdef here if present on other boards */
    //#define USE_UART3
    //#define USE_SOFTSERIAL1
    //#define USE_SOFTSERIAL2
    #define SERIAL_PORT_COUNT 2

    //#define SOFTSERIAL1_RX_PIN PA6 // PWM 5
    //#define SOFTSERIAL1_TX_PIN PA7 // PWM 6

    //#define SOFTSERIAL2_RX_PIN PB0 // PWM 7
    //#define SOFTSERIAL2_TX_PIN PB1 /

  • You might need to comment out all these if they are enabled:
    //#define USE_GPS_UBLOX
    //#define TELEMETRY_FRSKY
    //#define TELEMETRY_HOTT
    //#define TELEMETRY_LTM
    //#define TELEMETRY_SMARTPORT
    //#define CMS
    //#define TELEMETRY_CRSF
    //#define TELEMETRY_IBUS
    //#define TELEMETRY_JETIEXBUS
    //#define TELEMETRY_MAVLINK
    //#define TELEMETRY_SRXL

    //#define USE_RANGEFINDER
    //#define USE_RANGEFINDER_HCSR04
    //#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
    //#define RANGEFINDER_HCSR04_ECHO_PIN PB1
    //#define RANGEFINDER_HCSR04_TRIGGER_PIN_PWM PB8
    //#define RANGEFINDER_HCSR04_ECHO_PIN_PWM PB9

  • Rebuild, run Cleanflight and  flash the new firmware which is the hex file  located in in the obj directory.
  • Connect Cleanflight normally and go to Ports and activate GPS on UART2
  • Go to Configuration and enable magnetometer and GPS, making sure that you select NMEA or UBLOX according to which flag you turned on on the build.
  • You should be up and running with mag and GPS.

 

About hbouzas

Born in Buenos Aires, Argentina. Studied Physics at the University of Buenos Aires. Joined Schlumberger in February 1985 in Houston, Texas, and worked in several technical and managerial positions until 2000. From 2000 until 2008 held several management positions in Abingdon, UK; Calgary, Alberta and London, UK. Worked in the areas of Geophysical Exploration, Geological Modeling, Structural Modeling, Reservoir Modeling and Petroleum Economics and holds several patents. He is currently the Norway Technology Center Manager for Schlumberger Information Solutions and is based in Oslo and Stavanger. Main interest are software, technology, innovation, 3D visualization, design, human computer interaction, energy, environment.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment