APM1, 2 Programmers Aaargh

335 views
Skip to first unread message

David Pawlak

unread,
Aug 13, 2014, 4:09:56 PM8/13/14
to drones-...@googlegroups.com
Hi,

Man, it was hardly more than 2 yrs ago, I used the Arduino 1.0.3 to load some of the latest code....

and now I am trying to get something going and I can't get it to upload!

2 yrs ago is long enough that I'm almost not sure, but I connected with a standard USB cable, compiled and programmed.

So a lot of water has gone under the bridge, and I see it flowing below in streams of posts here and there, but the documentation doesn't cover it at all.

You have to load MHV_AVR first? It doesn't say why or what it does, I don't remember that before (but then that was 2 yrs ago). I tried it with and without, no diff.

You have to translate the ardupilot library from the git repository to the arduino repository (I suppose... it doesn't state this) but I remember that you had to do something similar before. Finally doing that allowed me to finish the compile.

But now it doesn't upload. Claims errors in avrdude.conf. I don't think we are using avrdude... or are we? I was expecting Arduino to upload...... And thought I had set that in the tools menu... although it doesn't seem to matter WHAT I put there.

I'm just trying to program a simple APM2. Can someone help. Once I sort it out, I'll look into doing a proper wiki!


Robert Lefebvre

unread,
Aug 13, 2014, 5:12:48 PM8/13/14
to drones-discuss
David, are you using the special version of the Arduino IDE that we have?  Up in the menu bar, to the right of tools, you should see a menu ArduPilot.  If you don't have that, then you don't have the correct version of Arduino.  If you do that, make sure you set the board type under the HAL Board dropdown.

I do not move the library from the repository to the Arduino directory.  Leave it in the GIT director.  But you have to point Arduino to the proper director using File/Preference/Sketchbook Location.

Rob


--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philip Rowse

unread,
Aug 13, 2014, 6:19:33 PM8/13/14
to drones-...@googlegroups.com
have a look at 

the reason is.... the code generated by Arduino is just too big to fit on the APM now, with just the standard features included......
the old method will still work if you lock out a bunch of functions with the defines.....

phil

David Pawlak

unread,
Aug 13, 2014, 6:26:45 PM8/13/14
to drones-...@googlegroups.com
Yes I have the special version. Thanks

And I set the preference to GitHub/ardupilot. It knows where the code is, and I open ArduCopter for instance from File->Sketchbook popup no problem

But Trying to compile, it doesn't see the libraries. So I copied them from the github directory to arduino, like you used to have to do and after reloading arduino it saw them no problem. I'm using "ArduPilot-arduino-1.0.3-windows", the one recommended in the wiki. (It just occured to me, that perhaps I needed to reload Arduino before trying to compile the first time..... I think I did, but I'll put the libraries back the way they were and try again after reloading (several times).

There's more problems, I DID get the arduino to compile (although it won't upload to the target) but now I want to use Amtel Studio 6.2 w/MicroVisual.. plugin.
It doesn't seem to recognize config.mk, and there's a few other errors with new static HAL declarations conflicting with global ones..... easy to fix, but now there's a few poisoned variables, but I can't find out where they're poisoned. It's just a few lines, but rather than change their names, it would be good to know what's going on.


Still don't know if it will upload. I guess if Arduino doesn't, Amtel Studio probably won't either. 

David Pawlak

unread,
Aug 13, 2014, 6:32:42 PM8/13/14
to drones-...@googlegroups.com
Hi Philip,

Yep, that's the exact wiki I'm using. Once I DID get it to compile (after copying the libraries, it compiled and within the space allocated. (I compiled "plane")

We cross posted, I'm going to check to see if it didn't see the libraries, because it needed a reload of arduino. It's strange it saw the sketch, but not the libraries, but it didn't surprise me, because that's the way it "used to be".

Philip Rowse

unread,
Aug 13, 2014, 6:41:21 PM8/13/14
to drones-...@googlegroups.com
cool, glad its working :)

Philip Rowse
Electronics Engineering Dept
3DRobotics
Ballarat
Australia

David Pawlak

unread,
Aug 13, 2014, 6:50:37 PM8/13/14
to drones-...@googlegroups.com
Well, "working".... at least compiling. Doesn't upload yet. I get an avrdude.conf error. I'm trying to get arduino to upload (like it used to do) through the USB port.

David Pawlak

unread,
Aug 13, 2014, 7:43:17 PM8/13/14
to drones-...@googlegroups.com
OK Robert,

I guess somehow I must have tried to compile before I reset the arduino.

I put the old libraries back into the arduino sketch and reloaded arduino, and it finds the correct libraries from the github directory now.


On Wednesday, August 13, 2014 5:12:48 PM UTC-4, robert.lefebvre wrote:

David Pawlak

unread,
Aug 14, 2014, 7:03:06 AM8/14/14
to drones-...@googlegroups.com
Sorry for all the trouble.

The idea of course is to be able to contribute, once I get going. I had gotten a couple of compile errors (with arduino/Atmel) on a fresh synched master. There were two basically.

It didn't seem to be seeing the desired HAL_BOARD configuration (although it was selected here):


but that could have been because I might not of closed and reopened the gui before I loaded and compiled,

Then I got conflicts between the time functions like millis(), micros() etc, where there were static declarations for HAL implementation and global prototype declarations in arduplane.pde (I think it was). Not sure why that was, but maybe for the same reason as above.

Previously, I had done a PX4 compilation via PX4 console without any problems.

So I want to start over.... But for compatibility... I have to revert my edits. I haven't committed yet... How do I wipe the slate clean. I did a revert, and the pde files are all there and clean, I could even do a synch with ardupilot/master.

But the ino files are still there, and this produces a ton of errors on arduino for double declarations.

How do I clean this up?

David Pawlak

unread,
Aug 14, 2014, 8:10:20 AM8/14/14
to drones-...@googlegroups.com
And lastly (I hope):

As previously mentioned, I am using http://dev.ardupilot.com/wiki/building-ardupilot-with-arduino-windows/ as a guide.

Originally I skipped the MHV_AVR and did the arduino install and tried it. Two reasons for that. 1) The link on the wiki is broken, and 2) I thought I remembered that arduino had it's own driver to upload.

So I got the avrdude error, and then went back to find a working link to the MHV_AVR Tools. Don't remember where I found them, but they are exactly the same ones.

However, I still get the avrdude error. I presently have the following selected:

I still have to do a clean compile on plane, after I figure out the answer to the previous post, but I did a clean compile on Copter just now, and then trying to upload, I still got the avrdude error.

The error I get is:

avrdude: Version 6.0.1, compiled on Oct 17 2013 at 21:37:20
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\ArduPilot-Arduino-1.0.3-windows\hardware/tools/avr/etc/avrdude.conf"
avrdude: error at C:\ArduPilot-Arduino-1.0.3-windows\hardware/tools/avr/etc/avrdude.conf:332: programmer type must be written as "id_type"

It seems to clear up the error if you put quotes around the text at that line.... but there are like 50 lines or more like this, I can't imagine they are all wrong.

Wait... look what I found in the documentation from avrdude!
-------------
Major changes compared to the previous version:

    - Programmer types in configuration file are no longer keywords but
      specified as string.

      So you need to change 'type = XYZ;' to 'type = "XYZ";' in own
      config files.  (internal: The parser does not need to know all
      programmer types now, new programmers will update only the table
      in pgm_type.c.)
-------------

So somehow there's a mis-smatch between the avrdude version number, and the avrdude.conf file. !!??

Anybody know anything about this??



On Wednesday, August 13, 2014 4:09:56 PM UTC-4, David Pawlak wrote:

Robert Lefebvre

unread,
Aug 14, 2014, 4:27:31 PM8/14/14
to drones-discuss
Do you have the board type set to Atmega2560?  You need to do that, as well as the HAL board.


David Pawlak

unread,
Aug 15, 2014, 9:21:25 AM8/15/14
to drones-...@googlegroups.com
I've followed the wiki to the letter. Although I missed the one step that said "close the GUI and start it again, then proceed to... "

But that's a one time thing.

David Pawlak

unread,
Aug 16, 2014, 12:13:57 PM8/16/14
to drones-...@googlegroups.com
Can somebody who programs APM 1 or 2 confirm which version of avrdude is used by the special arduino 1.0.3 

It's so strange. It's using avrdude from the newly loaded directory in arduino and yet it doesn't seem compatible with the .conf file (Again, taken from the arduino directory chain)


On Wednesday, August 13, 2014 4:09:56 PM UTC-4, David Pawlak wrote:

David Pawlak

unread,
Aug 16, 2014, 2:41:57 PM8/16/14
to drones-...@googlegroups.com
Another thing I don't quite understand:

If I compile using Atmel Studio and Visual Micro, various project  files are created for the IDE that github sees, and wants to include in the new commit.

I deleted (moved really) all the .ino files, and it seems github doesn't worry about those. they aren't there and don't represent a change to the coding. But these extra files created by Atmel are still there like new parts to commit.


How do I resolve this? I did a fresh compile of copter (unmodified)... I think with just arduino, and I don't have this problem. I could modify with arduino (is that what you all do?) So what's the value of Atmel? 

I want to get down to contributing. It seems that for the Pixhawk, all's well, but there are still things that can be done for APM1,2. 



On Wednesday, August 13, 2014 4:09:56 PM UTC-4, David Pawlak wrote:

David Pawlak

unread,
Aug 18, 2014, 10:59:09 AM8/18/14
to drones-...@googlegroups.com
For APM2 I think all's well, at least for the compiling, to just use Arduino. I use Atmel for editing, no problem, as long as I don't compile, it doesn't add files to my commit list.

Still have the problem with avrdude though. Don't understand what happened there?


On Wednesday, August 13, 2014 4:09:56 PM UTC-4, David Pawlak wrote:

David Pawlak

unread,
Aug 19, 2014, 12:18:22 PM8/19/14
to drones-...@googlegroups.com
Well, I don't know what's going on, but I copied the ardupilot code over to another computer where I had (supposedly the same arduino installed), and I compiled and downloaded no problems to an APM2. It even included the new commit I made for a vSTOL mixer. (So I have that running on APM2.6 AND Pixhawk.)

Don't know if my problem is related to Win8, but somehow don't think so. It worked on the Win7 machine,

I created that arduino environment back when I was first playing with APMs a couple of years ago, and I'm not even sure what instructions I followed. Probably something that was on google.code. 

It's quite possible the latest one (on W8) has a newer gcc version, and maybe a newer avrdude, which is the part that is causing the problems. But the arduino version is the same.

IF I can ever understand what's going on, I'll try to give a go at the wiki. There are a number of wikis that either piece together other wikis, and which duplicate and sometimes confuse. There are others that work if you hold your mouth right, but if some little thing is not quite right, it doesn't have enough information to get you on the straight and narrow.

It has seemed harder than it should be to get into a position where you can give back. Perhaps with tools and compilers half thrown together, one can go ahead and make improvements to his own equipment, but if the objective is to have people contributing to the system..... then we're losing fair numbers.



On Wednesday, August 13, 2014 4:09:56 PM UTC-4, David Pawlak wrote:

Javier Diaz

unread,
Aug 20, 2014, 9:52:41 PM8/20/14
to drones-...@googlegroups.com
I had the same problem, I downloaded MHV_AVR_Tools_20131101.exe and replaced avrdude.conf and it started to build

David Pawlak

unread,
Aug 21, 2014, 7:50:34 AM8/21/14
to drones-...@googlegroups.com
Excellent, I'll give that a try, thanks
Reply all
Reply to author
Forward
0 new messages