Offline
Newbie
Karma: 0
Posts: 17
|
 |
« on: September 22, 2011, 10:36:56 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #1 on: September 23, 2011, 12:15:42 am » |
PCB needs oscillator source too.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #2 on: September 24, 2011, 07:26:32 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #3 on: September 24, 2011, 07:42:52 pm » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #4 on: September 25, 2011, 04:47:47 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #5 on: September 25, 2011, 05:43:35 pm » |
"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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #6 on: September 25, 2011, 06:11:00 pm » |
"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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #7 on: September 25, 2011, 06:24:44 pm » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #8 on: September 25, 2011, 06:42:58 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #9 on: September 25, 2011, 07:56:46 pm » |
Yes, I guess it would. But plan ahead leave pads for one.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #10 on: September 25, 2011, 08:02:03 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #11 on: September 25, 2011, 08:38:57 pm » |
Well, you have to come back at least once at let us know how it went 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #12 on: November 15, 2012, 01:14:26 pm » |
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
Brattain Member
Karma: 242
Posts: 16469
Available for Design & Build services
|
 |
« Reply #13 on: November 15, 2012, 04:40:02 pm » |
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
|
|
|
|
|
|