Society of Robots - Robot Forum

Software => Software => Topic started by: wecool44 on October 23, 2011, 03:51:40 PM

Title: Axon + Arduino
Post by: wecool44 on October 23, 2011, 03:51:40 PM
I recently ordered an axon, and I found out that it uses a atmega640 processor. Then I looked at arduino, and they support AVR. But they do not support the 640. So my question is, can somebody give me the text to add to the arduino boards list so I can use the axon with arduino ide?
Title: Re: Axon + Arduino
Post by: joe61 on October 23, 2011, 05:30:16 PM
There's a thread on the Arduino forum asking that very question here (http://arduino.cc/forum/index.php/topic,24180.0.html). I couldn't resolve the link to the arduino-extras file though, and github doesn't seem to have it either. You might drop the author an email.

Joe
Title: Re: Axon + Arduino
Post by: wecool44 on October 24, 2011, 07:59:39 PM
Thanks. After a bunch of googling, i found the files. Now the only problem I'm having is finding out what number the lettered pins refer to. The software obviously doesn't like a3.
Title: Re: Axon + Arduino
Post by: joe61 on October 24, 2011, 08:47:15 PM
The pin mapppings between the 328 and Arduino are given on the Arduino site: http://arduino.cc/en/Hacking/PinMapping168 (http://arduino.cc/en/Hacking/PinMapping168)

I think that's what you meant.

Joe
Title: Re: Axon + Arduino
Post by: Admin on October 25, 2011, 02:09:15 AM
please post the files here :P
Title: Re: Axon + Arduino
Post by: KurtEck on October 25, 2011, 07:06:12 AM
If I were going to try to use my Axon2 as an Arduino, I would probably start by probably needing to setup the pin mappings.  Probably in the file:
C:\Arduino-0022\hardware\Arduino\cores\Arduino\pins_arduino.c
Note: depends on where your Arduino install is...

Next I would probably hack up a boards.txt to add a new entry.  Not sure what to do for the bootloader or the like here.   

as for the pin name: a3, try A3 (case sensitive).

Good Luck
Kurt
Title: Re: Axon + Arduino
Post by: Admin on October 25, 2011, 10:31:02 PM
Just as an FYI, the Arduino Mega has the *exact same* I/O as the Axon. The only difference between the chips is Flash memory size.
Title: Re: Axon + Arduino
Post by: joe61 on October 26, 2011, 06:35:15 AM
Good point, I posted a link to the wrong mapping earlier. Try this thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245229578) for what looks to be the right one.

Joe
Title: Re: Axon + Arduino
Post by: KurtEck on October 26, 2011, 08:32:40 AM
Just as an FYI, the Arduino Mega has the *exact same* I/O as the Axon. The only difference between the chips is Flash memory size.
Oops - I forgot to mention that above. Or more particular that Atmega640/1280/2560 are pin interchangeable. In fact one of the pictures on the Axon2 datasheet shows a 2560.

So the first pass with pins_arduino.c would simply be to change the line:
Code: [Select]
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)To include probably: (__AVR_ATmega640__)

You could maybe try to play around and map the pins differently than the default Arduino pin mappings, to maybe have it that pin 2 is near pin 3 4 5 6... But I think I would avoid this as probably lots of library code makes assumptions on which pins are PWM pins, ...

What I was wondering is if you could somehow configure Arduino to download using your bootloader.  My guess is that you could get Arduino to download to this, by changing the upload.using to an ISP that you have defined...

But so far I have not tried to do any of this yet.

Kurt
Title: Re: Axon + Arduino
Post by: Ro-Bot-X on October 27, 2011, 06:20:37 AM
Some time ago I was trying to use the Arduino IDE to write code for my Axon I controller. In the end I just went through all of the files in the cores/arduino and added the || (__AVR_ATmega640__) everywhere there was a line mentioning ATmega 2560. I could then program and compile without problems. But I have an old AVR ISP programmer that doesn't work in Arduino IDE for some reason and I couldn't upload the code using that. So I was trying to get the bootloader to work, but I'm not a software guy, I didn't know how to tweak the bootloader to work with the Axon. I asked for help, I got some response, but it didn't work. First of all, the Axon doesn't have a Reset button, so I had to use the reset connection on the ISP header to try an autoreset or do it manually, but that wasn't the problem. The bootloader was just not communicating with the IDE. I can however upload the hex file from AVR Studio using my programmer, but that was not what I intended to do. Also, the hex file is hard to find if you use the Arduino-0022 IDE.
Title: Re: Axon + Arduino
Post by: KurtEck on October 27, 2011, 08:15:49 AM
Yep, sounds like some of the fun I have had with trying some of the AVRISP programmers and Arduino IDE.

I was not trying to program the Axon, but trying to burn a bootloader on an ATMega328 on a prototype board.  I could not get my old AVRISP to talk to the board, so I was needing something from mouser and the AVRISP2 was reasonably priced and I ordered one of them.  When it arrived, It also would not talk to the board in the Arduino IDE.  I then tried my OLIMEX AVRISP, which worked after I added some stuff to the programmers.txt file... I did not try the OLIMEX one earlier as I originally was using this to program the Axon2 and it was soooo sllllloooowwww, where the bootloader downloaded the program several times faster.

In my web searching to make all of this work, in several places I found comments about not being able to get the Atmel AVRISP2 to work with the Arduino IDE.  From what I read it sounds like both AVR Studio and Arduino IDE have device drivers for the AVRISP, which are not compatible with each other and you can get it to work with the IDE by uninstalling the drivers from Studio... I have not tried this yet.

As for using the bootloader to download, my guess is that may be difficult as the Axon does not use the FTDI USB to serial chip and there is probably not any setup to use something like Avrdude to download a program.  Don't know if the bootloader is compatible with some other standard downloader like STK500 or the like.  I doubted it, as if it was, then when people were having issues downloading from Win7 64 bit to the Axon, I think they would have tried going down this route.  Could be wrong.

Kurt
Title: Re: Axon + Arduino
Post by: Admin on October 27, 2011, 09:24:57 AM
If it helps you guys any . . . my understanding of the Arduino bootloader is that it uses the FTDI chip handshaking pins to initiate a hardware reset of the AVR. In other words, it's a hardware 'deficiency' preventing the use of the Arduino bootloader with non-Arduino type boards.

Don't quite me on that, but it's worth investigating. I'm sure the Arduino datasheet will be a dead giveaway.
Title: Re: Axon + Arduino
Post by: KurtEck on October 27, 2011, 11:18:31 AM
Thanks Admin,

Yes, it does use the DTR line coming out of the FTDI chip to trigger a reset.  This same technique appears to be used in many different boards/micro controllers, that use DTR or the RTS lines to reset the processor, including the Arduino, some propeller boards I have seen, Basic Micro Processors, ...

But regardless of this, Some Arduino, can be set up to automatically or manually be reset to be programmed.  There is for example a switch on the Seeeduino Mega boards for this.  When in manual mode, you have to hit the reset switch within a short period of time after the program like AVRDude is wanting to talk to the board.  I used to have to do this with the old Seattle Robotics Society workshop boards...   So my guess is that if your bootloader was compatible with for example the STK500 protocol (http://www.atmel.com/dyn/resources/prod_documents/doc2591.pdf (http://www.atmel.com/dyn/resources/prod_documents/doc2591.pdf)), than you could use download using any software that was designed to handle this protocol, such as Avrdude.

Kurt