Pages: [1]   Go Down
Author Topic: Arduino as a programming bridge to another Arduino  (Read 762 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had this crazy idea some days ago..

I have an Arduino Duemilanove and a couple of bare ATMEGA168s. I mainly use the ATMEGA168s for "short life" projects on a breadboard so I can try different sketches etc smiley-wink

I'm currently using the ATMEGA168s without the Arduino bootloader and I program them with the BitBanging method. That not easy for me, because I have to remove and insert the different chips, risking their.. pins ;D

Can the Arduino be used as a bridge to another Arduino chip?

( PC ) -- program --> Duemilaove -- program --> Arduino bootloaded chip

Of course a modified IDE will be needed in order to stop the autoreset feature or perhaps a (permanately) modified board.

Any ideas are welcome! ;D
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you pop the ATMega out of the arduino board, you can then simply carry the appropriate connections to the chip on your breadboard (TX, RX, RST, GND at least), no modifications necessary.  Alternatively, you can get one of the various FTDI boards like this one to program breadboard arduinos.  
Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you! Those breakout boards are just what I needed! smiley

I also found this project* which is exactyly what I want! And no need to use the bootloader smiley-wink

*http://code.google.com/p/mega-isp/
Logged

Bonn, Germany
Offline Offline
God Member
*****
Karma: 0
Posts: 903
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hm, there are several ways of doing this. The simplest (from what i know) are:

1) Build a programmer. There was a sketch ( i think it is called ISPMega or so) that you have to upload on your standard arduino. Now with simply connecting 4 lines you can program a fresh Atmel the way you want, even upload programmes

2) This one is just an idea - havent tried it so far:
You could connect the RX and TX lines of your USB Arduino to the RX and TX lines of the second Arduino and reroute the upload that way. Downside is defenetly that you already need a bootloader on the second arduino

3) Try to rewire a ZIF socket to fit on your Arduino and just swap Chips as you need (the same as in the post above, yet i have ruined several atmels this way by breaking it's legs)
Logged

Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey! Thank for the reply smiley

1) I found that sketch! I was about to build an AVR on a breadboard smiley-wink I will try and make some modifications to the Arduino IDE .txt config files. I saw somewhere that you can set an uploader, eg AVRISP, the one that Mega-ISP "emulates"! smiley-wink

2) Also thought of that but I think it won't work because the on board AVR would interfere. It would work if I remove the on board AVR though!

I'm going to try and modify the IDE to upload a sketch to a bare AVR using an Arduino board with the Mega-ISP sketch smiley
Logged

Spokane, Washington
Offline Offline
God Member
*****
Karma: 0
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've got a a board I'm using for the same reason as of now.. just uploading / updating  some chips that are being used for a base station...
and well, I'm really cheap! The way I see it..

I could buy the programmer (about $20 ish) and well.. use it a few times. (I'm sure it will be more useful as I get more experienced)

Or I could buy an Arduino, so I have two! And I got the upgrade chip with it as well, so got an extra for my "breadboard Arduino".

I have to say, I LOVE that you can just hook the board up to the RX and TX! Makes things a million times easier.

One thing you've got to keep in mind when doing this, is choosing the right board and chip! Every time I change boards, I forget to change it back to the 168 when on the breadboard.
Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks CaptainObvious for the reply smiley-wink

Here's how I do it.

Uploading an Arduino sketch to a bare AVR or a Breadboard Arduino.

I remove the ATMEGA328 from my Duemilanove and insert the ATMEGA168 I want to program. I've modified the Duemilanove and connect the BitBanging cables.

On the IDE, I'm selecting the Lilipad Arduino (8mhz ftw) and a COM other than my Arduino's. Of course it displays a problem.. ;D I go to my sketche's folder and then on the "applet" folder inside it. TADA! There's a .hex! I grab it and burn it to my bare avr with the BitBanging method!
Logged

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That mega-isp was brillitant!  smiley

A big thanks to the folks behind mega-isp! Great work!

I have some extra atmega 328's that was empty with exactly this in mind.

Some problems though, avdude reports that the programmer is out of sync sometimes, quite often in fact. I don't know why that is, it generally means I can't verify. Eventually I chosed to ignore the error, and it seems to work - they can upload and run sketches from the arduino IDE smiley Which is what I wanted of course, I like that IDE. But I guess I can do (almost) without it now, but I'll wait with that until I need the space and get some more experience.

I'm really quite new to this, so the first tries didn't went too well. Until I read about the fuse settings. I followed the settings listed here: http://blog.modifiedelectronics.com/2009/08/arduino-atmega328-fuse-settings.html and (sort of) verified them against the fuse calculator here http://www.engbedded.com/fusecalc/


I used the ADABOOT bootloader btw, since that's what was shipped on my BBB - Bare Bones Board (Arduino compatible). And more important - it seems to be a very good bootloader. http://www.wulfden.org/TheShoppe/freeduino/ADABOOT.shtml

I'm not sure why the hex file is 6k, but the bootloader 2k. I guess there are other stuff in it as well, probably including the (hex) adresses of the contents?


The fuse settings for an Atmega 328 with a 2kB (1k word) bootloader is, or at least can be (though no guaranties, of course):

High: 0xDA
Low: 0xFF
Extended: 0xFD


Oh yeah, I almost forgot the lock-bits.. in fact I tested the atmega's in the Arduino IDE before settings these, but it sems to work even though I programmed these afterwards (I just used a simple blinker app to test from the Arduino IDE anyway, no fancy stuff like interrupts or program memory access).

I set the lockbits (according to the same blog) to be 0xCF. Checking the settings in the Atmega 328 datasheet seems to indicate it is safe, but I'm no expert (table 25-1 and 25-2 page 294).


Reading back (verifying) the extended fuse setting seems to be inverted, so there is an error about it being changed. Same thing with the lock bits, but that one seems to just be the upper nibble inverted (or ignored?). Ignoring these errors seems to work (as long as the device ID checks out).

Logged

Pages: [1]   Go Up
Jump to: