Pages: [1]   Go Down
Author Topic: ATMega2560 ICSP  (Read 2280 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an ATMega2560 board and I bought another ATMega2560 from newark.com.  I am designing a project on PCB using another ATMega2560.  How do I go about burning the bootloader onto my new ATMega2560 on the PCB.  And how do I program it on the PCB?

Do I need anything besides a connector from the ICSP to my PCB using MISO, MOSI, SCK, RESET, VCC, GND?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

PCB needs oscillator source too.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PCB needs oscillator source too.

Yeh, 16 MHz clock and two 22pf caps.  0.1uF Caps filter Power.  Should I be good to go with this and using an Arduino Board to burn bootloader/program it?  I will probably go ahead with this and then post my problems later as they occur.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, set it up with the ICSP pins and the minimal circuitry. In summary:
ICSP Pins as noted in originating post.
0.1uF caps on power lines,
0.1uF cap of Aref,
10K pullup resistor on reset,
16 MHz xtal,
22 pf caps.
If you plan to downloadl via serial interface at some time, add  Serial Rx & Tx lines, and 0.1uF cap to a DTR pin, then can connect USB to Serial adapter via jumper pins: +5,GND, Rx, Tx, DTR.

After that, whatever you plan to use:
4-pin I2C connectors? +5, GND, SCL, SDA - Maybe add 3.3V regulator also and bring out 3.3V
5-pin SPI connectors? +5, GND, MISO, MOSI, SCK, unique CS per connector
4-pin serial connectors? Rx, Tx, Gnd (Serial1, Serial2, Serial3)
Shift register connectors?  Data-in, data-out, clock, latch, clock, +5
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, set it up with the ICSP pins and the minimal circuitry. In summary:
ICSP Pins as noted in originating post.
0.1uF caps on power lines,
0.1uF cap of Aref,
10K pullup resistor on reset,
16 MHz xtal,
22 pf caps.
If you plan to downloadl via serial interface at some time, add  Serial Rx & Tx lines, and 0.1uF cap to a DTR pin, then can connect USB to Serial adapter via jumper pins: +5,GND, Rx, Tx, DTR.

After that, whatever you plan to use:
4-pin I2C connectors? +5, GND, SCL, SDA - Maybe add 3.3V regulator also and bring out 3.3V
5-pin SPI connectors? +5, GND, MISO, MOSI, SCK, unique CS per connector
4-pin serial connectors? Rx, Tx, Gnd (Serial1, Serial2, Serial3)
Shift register connectors?  Data-in, data-out, clock, latch, clock, +5


Alright,  my design pretty much already had everything above.  I have an Arduino Mega2560 Board and an UNO.  Couldn't I just use the TX, RX pins and remove the UNO to upload code to my MEGA2560 on PCB?  Or I could purchase http://www.sparkfun.com/products/718.  Either way that should work.  Also,  what if I have other IC's connected to my MOSI, MISO, SCK pins on my micro?  Will I still be able to bootload or should I add jumpers to disconnect them when trying to bootload?

Thanks for your help so far.  I am in my final year of school and still learning.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"Couldn't I just use the TX, RX pins and remove the UNO to upload code to my MEGA2560 on PCB?"
I believe so, if your MEGA2560 has a bootloader already installed.

"Also,  what if I have other IC's connected to my MOSI, MISO, SCK pins on my micro? "
If the other parts do not have outputs driving the same lines, I would think  you'd be okay without jumpers.

The FTDI board would be a handy addition for downloading code from a PC via the Serial port; you could connect any of the Serial, Serial1, Serial2, Serial3 at other times & use that as a debug monitor via Serial.printx statements in your code.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"Couldn't I just use the TX, RX pins and remove the UNO to upload code to my MEGA2560 on PCB?"
I believe so, if your MEGA2560 has a bootloader already installed.

The MEGA2560 does not have the bootloader.  I was thinking I could use the setup I had in the first post to burn the bootloader and then use the TX, RX from the UNO to upload code?  I am thinking correctly on this?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In my opinion,  you are indeed thinking correctly on that.
Do you have a 100nF cap from an external DTR pin to the reset line also? Need for automated reset durung serial downloads. Very handy.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In my opinion,  you are indeed thinking correctly on that.
Do you have a 100nF cap from an external DTR pin to the reset line also? Need for automated reset durung serial downloads. Very handy.

I do not,  I have a 22pf cap off of the reset line to GND and a 10k pullup to 5V.  If I am uploading the code from the UNO Board, shouldn't it already have a 100nF cap on the DTR line?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I guess it would. But plan ahead leave pads for one.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I guess it would. But plan ahead leave pads for one.

Yeah, good idea.  Better safe than sorry.  I might be back after I receive my PCB. Hopefully not though lol.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, you have to come back at least once at let us know how it went smiley-cool
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi crossroads

Im having a similar situation with a custom board that has an atmega2560. the ISP port is connected to a USB-SPI chip to talk to a PC without the need of drivers (like for the FTDI)
im trying to program the bootloader but this error appears:


avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: MOSI fail, SCK fail
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


Im using the avrisp mkii and the custom board has all the caps and osc stuff in place.
could it be that this chip is interfering? thanks
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26943
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Could be - is it driving the SCK & MOSI lines when Reset is active? You need it off those lines when the MKii pulls Reset low.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: