I am having the Arduino UNO and Arduino ATMEGA 2560 board with me . Shall i use this arduino board USB port to upload the compiled sketch into my new atmega2560 chip with custom board. if yes, what can be done. Kindly let us know.
I’m not fully clear what you mean. As I’m sure you know, each device needs connecting to your PC via USB cable to upload a sketch to it. If you have for example two USB ports on your PC or laptop, and you have connected them to the UNO and Mega, then you will need to use Tools to choose the correct board and port.
This is pretty basic stuff, so I suspect I must have missed something in your question!
Are you wanting to run both at once?
Hi, Thanks for the reply.
I had developed the custom board with new atmega2560 chip. I have no usb port in my custom board. I am having original arduino UNO board and arduino mega board in my hand. Using this UNO/Mega board USB port, can i able to program my new chip atmega2560 in my custom board via TX and RX pin with UNO/Mega board? if yes, how can be done.
Yes, you can use them as serial-to-usb converters. Keep their reset pin LOW, connect Tx of the Uno/Mega to Tx of your other 2560, connect Rx of the Uno/Mega to Rx of your other 2560.
// Edit
Forgot the obvious GND connection between the two; and possibly 5V but that depends on the setup.
Thanks, now understood. I hadn’t registered the third item, the chip.
Hi sir. Thanks for the reply.
Keeping Arduino mega board as programmer.
Keeping new chip mega2560 board as target.
I will try this:
Programmer mega (5v)--> Target mega 2560 chip(5V)
Programmer mega (gnd)--> Target Mega 2560 chip(Gnd)
Programmer mega (Tx)--> Target Mega 2560 chip(TX)
Programmer mega (RX)--> Target Mega 2560 chip(RX)
Programmer mega reset pin to gnd
Target mega 2560 chip reset pin --> open or gnd ? Kindly let us know.
I forgot about that, sorry; with the given approach you will need to manually pull reset LOW at the right moment which can be tricky. A dedicated serial-to-usb that has the DTR pin broken out might be a better option.
Hi sir. Thanks for the reply.
You mentioned this abt target reset pin.
Programmer reset pin is continuously pulled low to gnd.?
I have to check my new chip atmega2560 is programming. So i will try this method. Any details or document abt this method. Kindly share.
Parallely plan to buy usb to ttl convertor.
Yes
Your chip has a bootloader, else you would not have been asking the question. Do you need a bootloader? You can alsway program via ICSP (assuming you have nothing connected to the ICSP pins or you can disconnect that).
If you want to buy something very useful, buy Pololu USB AVR Programmer v2.1. It's both a ICSP programmer as well as a serial programmer and can be used if you ever need a converter for e.g. TX1/RX1 on a Mega. Maybe a little expensive but people that have it seem to swear by it; I have the older version.
Your chip has a bootloader, else you would not have been asking the question. Do you need a bootloader? You can alsway program via ICSP (assuming you have nothing connected to the ICSP pins or you can disconnect that).
Yes sir. I have a USBasp programmer in which i have burned the bootloader in it.
I tried to upload the compiled sketch(blink.ino example) into the new chip it is showing as done uploading
But the blink code is not running after uploading the sketch.
I can't really help you with that; further I think that the first thing required would be a schematic.
You can upload the blink sketch using the USBasp and see if that will work. It will wipe the bootloader but you can always burn that again.
Hi sir. Thanks for the reply.
What are the ways to upload the compiled sketch into the new chip.?
I have usbasp programmer to burn the bootloader. Uploading the compiled sketch into the chip with usbasp programmer doesnot work for me. Is there anyother ways to upload the compiled sketch into the chip.
Why not? Did you try <shift><ctrl>U
or <shift>
plus upload icon?
Hi sir. Thanks for the reply.
With usbasp programmer device, i have to upload using upload using programmeroption or just upload option?
Upload using programmer; that is the shortcut that I did provide
Hi sir. I tried this method to upload the sketch using the Arduino UNO board with my new chip 2560 target board. Now my chip is loaded with blink.ino and the digital pin 13 is toggling with One sec ON/OFF. It seems the bootloader had successfully burned. and the sketch of blink.ino is uploaded into the target 2560 chip with 16mhz external crystal.
My problem is, first time i tried to upload the program. It is done successfully. after that second time, i tried to upload the code with same setup. it is showing the error as follow:
Sketch uses 1536 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Failed uploading: uploading error: exit status 1
what could be Problem. Kindly let us know to resolve it.
It's not clear to me how you did upload the blink sketch? Via serial or via ICSP?
If the former, I do not know why it would fail at a second attempt. If it's via ICSP, loading blink.ino will wipe the bootloader so attempting to do an upload via serial will fail.
Hi sir. Thanks for the reply.
First i burn the bootloader with the Usbasp Programmer with ICSP port to my target board and then removed the Usbasp programmer.
I used usbasp programmer to burn the bootloader.
after that i tried with serial TX and RX pin with Arduino Uno. First time it gets upload sucessfully and the blink program is loaded. it is failing at second attempt.
Only one time i have burn the bootloader with usbasp programmer and i removed that.
In that case I do not know why subsequent uploads will not work; sorry.
Hi sir, Thanks for the reply.
Kindly confirm some doubts. if the bootloader does not burn --> 1 sec ON/OFF (blink.ino) timing will be changed. So the bootloader burned successfully. the new chip is also working with the first attempt, So the chip is also working with 16MHZ External Crystal with 1 sec ON/OFF blink code. So if it is confirmed, i will go for the purchase of USB to TTL Convertor for programming. I thought that the issue is may be with the reset pin control of the target chip. Please correct me if i am wrong.