Pages: [1]   Go Down
Author Topic: Standalone Programmable ATMega1280/2560  (Read 1487 times)
0 Members and 1 Guest are viewing this topic.
Bristol, United Kingdom
Offline Offline
Newbie
*
Karma: 0
Posts: 23
ARGH dwee No!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all

I'm looking at using an ATMega1280 chip in a project, and I want to program it using the arduino IDE and code.

The thing is, I want to use it on a standalone PCB. Now, I understand the basics of making, say, a standalone ATMega328 circuit (And I assume a standalone 1280 wouldn't be much more complicated), but I don't know how to include some programming capability. Until recently (as I understand it), the FT232L chip was included in Arduinos just to turn the USB into a serial connection for the ATMega chip. Does that mean if I use a USB-to-TTL cable (Such as the 'USB to Serial TTL Cable' from CoolComponents, say) I can get rid of the usb chip and program the ATMega directly? I'm still slightly confused about what you'd do about the auto-reset and stuff, though. Ideas?

And on top of that, there's the issue of getting the bootloader on. Again, I know that for the Arduino 2009/Uno you can burn the bootloader via the USB if you use the Arduino IDE. So burning the bootloader to a 328 or whatever isn't such a big deal, as it's a plug-and-play chip anyway. But obviously the SMD 1280/2560 can't be bootloaded on a Mega board then slotted into my PCB. So the question is this - how can I build in bootloading AND programming ability to an ATMega1280/2560 standalone circuit? And is it possible to do all that via serial?

I've been doing electronics for a while, but microprocessors are quite new to me. If you'd rather direct me to some useful links than write an essay, I'd be very greatful.

I'll try and get a preliminary cct diagram up asap.

Many thanks
Tom
Logged

Tom

DeKalb, IL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 243
KB9SXU
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does that mean if I use a USB-to-TTL cable (Such as the 'USB to Serial TTL Cable' from CoolComponents, say) I can get rid of the usb chip and program the ATMega directly?

Yes.  If you look at the older Mega schematic (not the new 2560 one) you can just remove the section that includes the FT232.  The pins that would normally be connected to the FT232 would just need to be brought out to a header.  You are basically just moving the FT232 to an external board.  I think it is pretty easy once you study the schematic, but let us know if you have any questions.

Quote
Again, I know that for the Arduino 2009/Uno you can burn the bootloader via the USB if you use the Arduino IDE

I don't think this is possible with a standard setup.  You can't just plug a standard Arduino in that has a virgin chip and load the bootloader. If this was possible than there would be no need for the bootloader to begin with.  It is possible to modify the Arduino to self program by using the bit-banging method, but lets pretend that doesn't exist for the moment.

To program the bootloader into the Atmega1280/2560 you will need to use an ICSP or Parallel programmer.  The ICSP is the easiest way.  You can either bring out a 6 pin header (2x3) that is similar to the ICSP headers on the standard Arduinos or just connect a programmer to the correct pins.  But either way you will need some separate programmer that is supported by avrdude and can program using ICSP.  So you would first build your board then program the chip with the bootloader.  Again the ICSP programming header configuration can be obtained by looking at the Mega schematic.  Essentially you need to connect MISO, MOSI, CLK, RESET, GND, VIN

Logged

Jeff K - JKDevices.com - home of the MegaMini

Bristol, United Kingdom
Offline Offline
Newbie
*
Karma: 0
Posts: 23
ARGH dwee No!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Jeff.

I thought that I've bootloaded via USB before, athough it was a few months a go and part of a job, so it was a bit mindless.

Thanks for that, I'll look into using avrdude. As for uploading code via the serial connection, do I need to worry about autoreset, or will it just be that 'press the reset button a bit before you upload' case?

Thanks for your help

Tom
Logged

Tom

DeKalb, IL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 243
KB9SXU
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could still implement the auto reset feature very easily.

If you look at the schematic for the mega http://arduino.cc/en/uploads/Main/arduino-mega-schematic.pdf

You will see the FT232 circuit in the middle right. Imagine removing the FT232 from that diagram and then making a 5 pin header that would connect to where pins 1,5 and 2 of the FT232 once existed.  The other 2 pins would be GND and VIN (5 volts).  If you look at the schematic off of pin 2, it includes what is required for auto-reset. Everything else on that part of the schematic can be ignored.
Logged

Jeff K - JKDevices.com - home of the MegaMini

Bristol, United Kingdom
Offline Offline
Newbie
*
Karma: 0
Posts: 23
ARGH dwee No!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I guessed that maybe you could just pretend the FT232 wasn't there and wire it up, but I'm still at a loss as to how you'd implement the autoreset. I can't find out how the DTR# pin operates. Obviously it pulls the reset line low for just long enough to reset the ATMega, and then goes high again.

The solution I'm looking at using has the FT232 integrated and only outputs 6 of the pins, DTR# not being one of them. It grants you access to;

GND
CTS#
VCC
TXD
RXD
RTS#

Is there anything I can do with these? I've tried in vain looking for what all these 'CTS#'/'RTS#/etc signals are for, but I think my google-fu is weak this week.

I understand that the newer bootloaders only have a small window for new code to be uploaded, so the 'press reset button then upload' method becomes slightly more problematic.

If you need DTR# to properly implement the FT232 with auto-reset, then what about using the ICSP header? Does the reset connection on that deal with it in its own way?

Thanks for your help
Logged

Tom

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8439
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

AFAIK DTR is toggled (or just drvien low) by the IDE before the download starts. As this is coupled through a capacitor to the reset line the AVR sees a short low pulse.

If we're talking about the same FTDI cable then I think you can use pin 2 (RTS) to do the same job. I'm pretty sure this gets toggled as well.

______
Rob

Logged

Rob Gray aka the GRAYnomad www.robgray.com

DeKalb, IL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 243
KB9SXU
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If we're talking about the same FTDI cable then I think you can use pin 2 (RTS) to do the same job. I'm pretty sure this gets toggled as well.

I did a quick search on this and it seems to be correct.. so +1 that RTS will work just as well.
Logged

Jeff K - JKDevices.com - home of the MegaMini

Pages: [1]   Go Up
Jump to: