ArduCopter 3.2.1 and AntennaTracker 0.7.2 on MEGAPIRATE!

It’s a solution that you can build and upload the last APM 3.2.1 code for MEGAPIRATE BOARDS and AVR atmega2560 GENERICS BOARD with I2C bus communication.

As you know, megapirate team stop building APM and the last code was 3.1.5 version, we are desired work and port the last AVR APM 3.2.1 to this board, megapirate and AVR boards with atmega 2560 and I2C bus communication.

TESTED AND WORKING on MEGAPIRATE BOARDS:

  • ArduCopter 3.2.1
  • AntennaTracker 0.7.2

VIDEO WORKING APM 3.2.1 ON MEGAPIRATE:

[youtube.com/watch?v=baIYXkhdYcU](https://www.youtube.com/watch?v=baIYXkhdYcU)
  1. SOFTWARE TOOLS REQUIRED

These tools you need to download first.
1.1 Arduino 1.0.3 with gcc-4.8.2 version download from this link:

firmware.diydrones.com/Tools/Ard … indows.zip

1.2 Git tool, download from this link:

git-scm.com/downloads

  1. STEPS FOR COMPILING

2.1 Download and Decompress Arduino from section 1.1 to c:\arduino. You will see this order path c:\arduino\hardware\tools\avr\bin

2.2 Download and install GIT tool from section 1.2 to default path. NOTE.- in the steps windows install choose the option:

“Run Git from the Windows command Prompt”

2.3 Open Explorer and navigate to ‘c:’ drive, right click and select “Git bash here”, it’s open a windows command prompt.

2.4 In prompt command line type the next command to clone ArduCopter-3.2.1_I2C branch as follow:

$ git clone github.com/hiro2233/URUS8.git ardupilot
$ cd ardupilot
$ git checkout ArduCopter-3.2.1_I2C

2.5 Open Arduino, go to File, Preferences, in “sketchbook location” click on Browse and choose the path where are the ardupilot folder you checkout with GIT,
in this case c:\ardupilot, ok and close.

2.6 Now load Arducopter sketch, compile and upload to the MEGAPIRATE board.
Enjoy!
BUILDING CODE FOR ANTENNA TRACKER

  1. SOFTWARE TOOLS REQUIRED

These tools you need to download first.
1.1 Arduino 1.6.6 version, download from this link:

arduino.cc/download.php?f=/ardui … indows.exe

1.2 Git tool, download from this link:

git-scm.com/downloads

1.3 fix_includes_arduino166 program, With this tool you can change all include headers files to work with arduino 1.6.6 in windows.
You need compile the code, it’s included on repo branch master-AVR Tools/ArdupilotMega_ON_Generic_Board/

1.4 Notepad++, download from this link:

notepad-plus-plus.org/download/v6.8.8.html

  1. STEPS FOR COMPILING

2.1 Download and Install Arduino from section 1.1 to default path.

2.2 Download and install GIT tool from section 1.2 to default path. NOTE.- in the steps windows install choose the option:

“Run Git from the Windows command Prompt”

2.3 Download and install Notepad++ from section 1.4 to default path.

2.4 Open Explorer and navigate to ‘c:’ drive, right click and select “Git bash here”, it’s open a windows command prompt.

2.5 In prompt command line type the next command to clone Ardupilot master-AVR branch as follow:

$ git clone github.com/diydrones/ardupilot.git
$ git checkout master-AVR
$ echo “ARDUINO=/c/arduino” > /c/ardupilot/config.mk

2.6 Compile Tools\ArdupilotMega_ON_Generic_Board\fix_includes_arduino166 with VS2013 or SharpDevelop (with this one was compiled).
Then you use as follow:
fix_includes_arduino166 -P <PATH_TO_FOLDER>
Example: Supose that you cloned Ardupilot in c:\ardupilot then you will have c:\ardupilot\libraries and you want make AntennaTracker c:\ardupilot\AntennaTracker then,
fix_includes_arduino166 -P c:\ardupilot\libraries
fix_includes_arduino166 -P c:\ardupilot\AntennaTracker
WARNING!
This tool make changes to the files in all librarie path and this tool doesn’t make a backup of your files. You must be sure.

2.7 Open Arduino, go to File, Preferences, in “sketchbook location” click on Browse and choose the path where are the ardupilot folder you checkout with GIT,
in this case c:\ardupilot

2.8 Open the next file with notepad++, c:\ardupilot\libraries\AP_HAL\AP_HAL_Boards.h and replace this line #define AVR_ARDUINO_ENVIRONMENTS with //#define AVR_ARDUINO_ENVIRONMENTS. Save and close.
NOTE: If you uncomment this line, you are telling to Arduino make code for AVR Generic Board, but if you comment with this line with ‘//’ you are telling to Arduino make code for APM2 Board.

2.9 Open AntennTracker in Arduino and compile.
ENJOY!
If you are looking for detailed and description file libraries modification follow the oficial PR on the oficial Ardupilot repo at:

[github.com/diydrones/ardupilot/pull/3578](https://github.com/diydrones/ardupilot/pull/3578)  ;

(DEVELOPERS) AVR and MEGAPIRATE DEVELOPMENT SUPPORTS Version Boards
Chat discussions at gitter.im/dronebo/URUS8

(USERS) MEGAPIRATE and AVR SUPPORT
Forum Discussions and supports at drone.bo/foro/development-english/apm

Great work! Does it support sbus connection?

Thanks!

It’s only support PPM. You need SBUS to PPM converter.

1 Like

Dear hiro2233, I’m compiled and uploaded firmware to the board (AIOP V2) and all working well, just telemetry doesn’t work. On mpng 3.1.5 it’s working. What is the problem?

Hi satush, thats great! Telemetry are present in UARTC and UARTA. GPS are in UARTB.

Hi Hiro, You state that Telemetry are present in UARTC and UARTA. GPS are in UARTB. For my blue HK_ AIOP i cannot connect anything else then USB and GPS on Serial 2. I have tried with SIK radio on Serial 3 or Serial 1 without success. Same for BT or WiFi. I managed SIK radio connect Rx0 Tx0 to the FTDI port beside USB. What code do i need to check, and do i find it in system.pde? In old MPNG i was able to connect to Serial 1, 2 and 3. There is no Serial Protocol parameters i MP, neither can i adjust baudrate for Serial 2 or 3 since there is no parameter. Only SR0 baudrate and SR1 baudrate can be adjusted. Below parameters if somebody can find some errors please let me know.

#NOTE: 06.08.2017 15:24:30 Frame :
ACRO_BAL_PITCH,1
ACRO_BAL_ROLL,1
ACRO_EXPO,0.3
ACRO_RP_P,4.5
ACRO_TRAINER,2
ACRO_YAW_P,4.5
AHRS_COMP_BETA,0.1
AHRS_GPS_GAIN,1
AHRS_GPS_MINSATS,6
AHRS_GPS_USE,1
AHRS_ORIENTATION,0
AHRS_RP_P,0.1
AHRS_TRIM_X,-0.007101108
AHRS_TRIM_Y,0.01170355
AHRS_TRIM_Z,0
AHRS_WIND_MAX,0
AHRS_YAW_P,0.1
ANGLE_MAX,4500
ARMING_CHECK,1
ATC_ACCEL_RP_MAX,0
ATC_ACCEL_Y_MAX,0
ATC_RATE_FF_ENAB,0
ATC_RATE_RP_MAX,18000
ATC_RATE_Y_MAX,9000
ATC_SLEW_YAW,1000
BAROGLTCH_ACCEL,1500
BAROGLTCH_DIST,500
BAROGLTCH_ENABLE,1
BATT_AMP_OFFSET,0
BATT_AMP_PERVOLT,17
BATT_CAPACITY,3300
BATT_CURR_PIN,-1
BATT_MONITOR,0
BATT_VOLT_MULT,4.072016
BATT_VOLT_PIN,-1
BATT_VOLT2_MULT,1
BATT_VOLT2_PIN,-1
CH7_OPT,4
CH8_OPT,17
CIRCLE_RADIUS,10
CIRCLE_RATE,20
COMPASS_AUTODEC,0
COMPASS_DEC,0.04712389
COMPASS_EXTERNAL,0
COMPASS_LEARN,0
COMPASS_MOT_X,9.731142
COMPASS_MOT_Y,2.384646
COMPASS_MOT_Z,-6.813044
COMPASS_MOTCT,1
COMPASS_OFS_X,87.32372
COMPASS_OFS_Y,7.828816
COMPASS_OFS_Z,0.7902135
COMPASS_ORIENT,0
COMPASS_USE,1
DCM_CHECK_THRESH,0.8
EKF_CHECK_THRESH,0.8
ESC,0
FENCE_ACTION,1
FENCE_ALT_MAX,100
FENCE_ENABLE,0
FENCE_MARGIN,2
FENCE_RADIUS,150
FENCE_TYPE,3
FLOW_ENABLE,0
FLTMODE1,0
FLTMODE2,0
FLTMODE3,9
FLTMODE4,5
FLTMODE5,6
FLTMODE6,2
FRAME,1
FS_BATT_ENABLE,0
FS_BATT_MAH,0
FS_BATT_VOLTAGE,10.5
FS_GCS_ENABLE,0
FS_GPS_ENABLE,1
FS_THR_ENABLE,0
FS_THR_VALUE,975
GND_ABS_PRESS,98323.34
GND_ALT_OFFSET,0
GND_TEMP,28.71663
GPS_HDOP_GOOD,200
GPS_NAVFILTER,8
GPS_TYPE,2
GPSGLITCH_ACCEL,1000
GPSGLITCH_ENABLE,1
GPSGLITCH_RADIUS,200
HLD_LAT_P,0.2
INAV_TC_XY,2.5
INAV_TC_Z,5
INS_ACCOFFS_X,0.0008985365
INS_ACCOFFS_Y,0.1929133
INS_ACCOFFS_Z,0.9257147
INS_ACCSCAL_X,0.9985271
INS_ACCSCAL_Y,0.9992984
INS_ACCSCAL_Z,0.9842055
INS_GYROFFS_X,-0.01571853
INS_GYROFFS_Y,-0.02478568
INS_GYROFFS_Z,-0.005698895
INS_MPU6K_FILTER,0
INS_PRODUCT_ID,0
LAND_REPOSITION,1
LAND_SPEED,50
LOG_BITMASK,830
LOITER_LAT_D,0
LOITER_LAT_I,0.5
LOITER_LAT_IMAX,400
LOITER_LAT_P,1
LOITER_LON_D,0
LOITER_LON_I,0.5
LOITER_LON_IMAX,400
LOITER_LON_P,1
MAG_ENABLE,1
MIS_RESTART,0
MIS_TOTAL,0
MOT_SPIN_ARMED,70
MOT_TCRV_ENABLE,1
MOT_TCRV_MAXPCT,93
MOT_TCRV_MIDPCT,52
OF_PIT_D,0.12
OF_PIT_I,0.5
OF_PIT_IMAX,100
OF_PIT_P,2.5
OF_RLL_D,0.12
OF_RLL_I,0.5
OF_RLL_IMAX,100
OF_RLL_P,2.5
PHLD_BRAKE_ANGLE,3000
PHLD_BRAKE_RATE,8
PILOT_ACCEL_Z,250
PILOT_VELZ_MAX,250
POSCON_THR_HOVER,333
RATE_PIT_D,0.0045
RATE_PIT_I,0.011
RATE_PIT_IMAX,5
RATE_PIT_P,0.14
RATE_RLL_D,0.0045
RATE_RLL_I,0.011
RATE_RLL_IMAX,5
RATE_RLL_P,0.14
RATE_YAW_D,0
RATE_YAW_I,0.015
RATE_YAW_IMAX,800
RATE_YAW_P,0.25
RC_FEEL_RP,100
RC_SPEED,490
RC1_DZ,30
RC1_MAX,2012
RC1_MIN,987
RC1_REV,1
RC1_TRIM,1504
RC10_DZ,0
RC10_FUNCTION,7
RC10_MAX,1900
RC10_MIN,1100
RC10_REV,1
RC10_TRIM,0
RC11_DZ,0
RC11_FUNCTION,0
RC11_MAX,1900
RC11_MIN,1100
RC11_REV,1
RC11_TRIM,0
RC2_DZ,30
RC2_MAX,2012
RC2_MIN,987
RC2_REV,1
RC2_TRIM,1504
RC3_DZ,30
RC3_MAX,2012
RC3_MIN,985
RC3_REV,1
RC3_TRIM,988
RC4_DZ,40
RC4_MAX,2012
RC4_MIN,987
RC4_REV,1
RC4_TRIM,1505
RC5_DZ,0
RC5_FUNCTION,0
RC5_MAX,2013
RC5_MIN,983
RC5_REV,1
RC5_TRIM,988
RC6_DZ,0
RC6_FUNCTION,0
RC6_MAX,2012
RC6_MIN,987
RC6_REV,1
RC6_TRIM,1450
RC7_DZ,0
RC7_FUNCTION,0
RC7_MAX,2012
RC7_MIN,987
RC7_REV,1
RC7_TRIM,1450
RC8_DZ,0
RC8_FUNCTION,0
RC8_MAX,2012
RC8_MIN,981
RC8_REV,1
RC8_TRIM,988
RCMAP_PITCH,2
RCMAP_ROLL,1
RCMAP_THROTTLE,3
RCMAP_YAW,4
RELAY_PIN,46
RELAY_PIN2,-1
RNGFND_FUNCTION,0
RNGFND_GAIN,0.8
RNGFND_MAX_CM,700
RNGFND_MIN_CM,20
RNGFND_OFFSET,0
RNGFND_PIN,-1
RNGFND_RMETRIC,1
RNGFND_SCALING,3
RNGFND_SETTLE_MS,0
RNGFND_STOP_PIN,-1
RNGFND_TYPE,0
RSSI_PIN,0
RSSI_RANGE,5
RTL_ALT,1500
RTL_ALT_FINAL,0
RTL_LOIT_TIME,5000
SCHED_DEBUG,0
SERIAL0_BAUD,115
SERIAL1_BAUD,57
SIMPLE,0
SR0_EXT_STAT,2
SR0_EXTRA1,4
SR0_EXTRA2,4
SR0_EXTRA3,2
SR0_PARAMS,10
SR0_POSITION,2
SR0_RAW_CTRL,2
SR0_RAW_SENS,2
SR0_RC_CHAN,2
SR1_EXT_STAT,2
SR1_EXTRA1,2
SR1_EXTRA2,2
SR1_EXTRA3,2
SR1_PARAMS,0
SR1_POSITION,2
SR1_RAW_CTRL,2
SR1_RAW_SENS,2
SR1_RC_CHAN,2
STB_PIT_P,4.18
STB_RLL_P,4.18
STB_YAW_P,2.5
SUPER_SIMPLE,0
SYSID_MYGCS,255
SYSID_SW_MREV,120
SYSID_SW_TYPE,10
SYSID_THISMAV,1
TELEM_DELAY,0
THR_ACCEL_D,0
THR_ACCEL_I,1.5
THR_ACCEL_IMAX,500
THR_ACCEL_P,0.75
THR_ALT_P,1
THR_DZ,100
THR_MAX,1000
THR_MID,500
THR_MIN,130
THR_RATE_P,6
TRIM_THROTTLE,333
TUNE,0
TUNE_HIGH,6000
TUNE_LOW,3000
WP_YAW_BEHAVIOR,2
WPNAV_ACCEL,100
WPNAV_ACCEL_Z,100
WPNAV_LOIT_JERK,1000
WPNAV_LOIT_SPEED,50
WPNAV_RADIUS,200
WPNAV_SPEED,50
WPNAV_SPEED_DN,50
WPNAV_SPEED_UP,50

Regards Espen

Hello @flyespen,
sorry for late reply, there are great news for the APM legacy boards and clones boards, i have developed a new system based on the master branch to use it with a IO cape and enhance the capabilities for the system on most free, open sourced and comercial platforms and boards.

This problem was solved on the new URUS HAL and this come with a new layer called SHAL (Synthetic Hardware Abstraction Layer) that can run on the APM 2.x boards too.

This is the oficial repo now and is a wip project, not ready meawhile, but we are updating it constantly.

thanks for your reply.

Thats great Hiro, tnx for info.
If you could send me zip-file i will be happy to test. I got the old version working since August. Have a look here…http://3600kongsberg.no/
Regards Espen