3D Robotics

New version of APM 1.0 code -- fixes MediaTek setup


UPDATE: Looks like some bugs snuck in. I've withdrawn this version. Please Dec 13 instead.


I've uploaded a new version of the APM 1.0 code, which has some minor bug fixes.

  • The bug where you had to reset your board after a cold start to get the MediaTek GPS module to be recognized is now fixed. (Thanks James Goppert!)
  • Several minor bugs that affected Altitude Hold in AUTO mode have been fixed. It's still not as rock solid on all aircraft as we'd like, but we're reviewing several strategies to improve it in the next version of the code. Right now it mostly uses the throttle to maintain both altitude and airspeed (if an airspeed sensor is connected), but this can be unreliable if the aircraft is not well-trimmed. We may mix in more elevator going forward. (Thanks to Doug Weibel for the fixes)
  • Various other minor fixes, and support for a new version of the MediaTek GPS firmware that we'll be releasing in a week or so.
  • As always, you can follow APM software enhancements and bug fixes here.


If altitude hold is not working reliably for you, try adding a few clicks of elevator trim to counteract whichever tendency your aircraft is showing. So if it consistently descends below the target altitude, dial in a few clicks of up elevator and see if that fixes it. We'll have a more robust solution in the next rev.


Too cold to fly this code? Try an Xplane flight simulation!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • 3D Robotics
    Yes, the blue MediaTek. I recommend you take out the battery. It's a common point of failure.

    Yes, magnetometer code is working.

    If your modes aren't changing you have bigger issues. I hope you've gone through all the CLI RC tests, have Ch5 plugged into IN7, and all that. If you've run through all those tests and still have problems, please start another thread so we can work through those.
  • here is my config file.


    First, you MUST uncomment the GPS PROTOCOL line below or the code will not compile.
    This is because we need you to tell the code which GPS module you're using, so we can load the right libraries.

    Second, there is a lot more you can do with configuration options is you want. See the APM manual for all the available options.
    //-------------- REQUIRED ------------------
    #define GPS_PROTOCOL GPS_PROTOCOL_MTK // You must uncommment this line by removing the slashes ("//") in front of the "#" and select either the default (GPS_PROTOCOL_MTK) or one of the following other supported GPS modules if you're using one of them instead:

    // Other allowed options include:
    // GPS_PROTOCOL_NONE        No GPS attached
    // GPS_PROTOCOL_IMU         X-Plane interface or ArduPilot IMU.
    // GPS_PROTOCOL_MTK         MediaTek-based GPS.
    // GPS_PROTOCOL_SIRF        SiRF-based GPS in Binary mode.  NOT TESTED
    // The GCS_PROTOCOL option determines which (if any) ground control station
    // protocol will be used.  Must be one of:
    // GCS_PROTOCOL_NONE        No GCS output
    // GCS_PROTOCOL_STANDARD    standard APM protocol
    // GCS_PROTOCOL_SPECIAL     special test protocol (?)
    // GCS_PROTOCOL_LEGACY      legacy ArduPilot protocol
    // GCS_PROTOCOL_XPLANE      HIL simulation ground station
    // GCS_PROTOCOL_IMU         ArdiPilot IMU output
    // GCS_PROTOCOL_JASON       Jason's special secret GCS protocol
    #define GCS_PORT 3
    // This determines which port APM will send telemetery on. The USB port is Port 0, for when you're testing on the ground. The Xbee port is Port 3, for the field and in the air and you want to send telemetery wirelessly
    #define SERIAL0_BAUD      38400
    #define SERIAL3_BAUD       38400
    // These determine the baudrate for the telemetry port.  Default is 115200bps for Port 3.
    // -------------------------------------------------
    // Are you using an airspeed sensor? Choose DISABLED if not.

  • One other problem I am seeing is the mode switch (I use a pot on my tx)

    Mode doesn't seem to change.

    My tx is putting out 970 to 1940 ms for channel 5.


  • BTW is the magnetometer code working ? I have it installed on my board.


  • We are talking about the blue Media Tek GPS right ?


  • Oh...W/O batteries ? My battery is in.Wonder if that is a clue ?




  • 3D Robotics

    Earl. I can't replicate. Let's wait to see if others show this issue. We're using GPS modules without batteries, BTW.


  • I spoke too soon.

    Problem is still there.

    I unplugged the AMU and when I powered it back up, same problem. 2 GPS inits and it hangs.

    If I let the unit power up WITHOUT the GPS plugged in and wait till all calibrations are done, THEN plug the GPS in, when it gets a lock everything operates fine.

    Something in the GPS init routine that is not right is what I suspect.

    I have tried this many times now and this is the results.



  • 3D Robotics
    Excellent. Glad to hear it and thanks for the update!
  • Ahhh....works now !!



This reply was deleted.