Can I upload new programs onto a MEGA2560 through a serial port connected to pins 2&3? (through the correct RS232<->TTL level shifters)
I know the 16U2 chip acts as a USB->serial converter and it also asserting the reset which starts the bootloader running on the 2650. Does it do anything else?
As long as I can time the reset correctly, is there anything else preventing reprogramming directly through the RX/TX pins?
And if I do this, will the application program still be able to use the serial channel?
-
1If there are resistors between the 16U2 and the 2560 then likely yes that may give you an opportunity to "overcome" the 16U2's transmit line, though reset timing may be tricky unless you graft in a way to drive that as well.Chris Stratton– Chris Stratton2014年05月08日 22:26:54 +00:00Commented May 8, 2014 at 22:26
-
I'm actually looking at making a clone which wouldn't even have the 16U2. I'd probably tie serial DTR to a reset circuit like the one the 16U2 is driving.AShelly– AShelly2014年05月08日 22:31:43 +00:00Commented May 8, 2014 at 22:31
-
1Then yes, you can just place a header for an FT232 header or similar, as the minimal interfaceless '328 boards do.Chris Stratton– Chris Stratton2014年05月08日 22:35:45 +00:00Commented May 8, 2014 at 22:35
1 Answer 1
The stock bootloader will accept the load of new programs on PE0(RX input) and PE1(TX output) (of the ATmega2560) just after reset. Note PE0/1 on the Arduino correspond to pins D0 and D1. Not D2 and D3. You could change the Boot loader if desired.
There is a 1K series resistor between the 16U2 and 2560's PE0/1. So you can directly connect your external TTL serial port's TX(out) to PE0(D0), without harm. And correspondingly connect PE1(D1) to the TTL Serial port's RX(in).
Next you need to synchronize the bootloader. Either by manually synchronizing the Reset of the 2560 with the starting of the download (of AVRdude). Or by connecting the DTR(out) of the TTL Serial Port through a 100nF capacitor to the RESET pin of the Arduino.
I would also recommend putting the 16U2 into reset, to get it out of the way. Simply place a jumper between ICSP1's RESET2(pin5) and GND(pin6).
-
Great. I was thinking of pins 2 and 3 on the 2560 chip - Thanks for pointing out that's it's D0 and D1 in the Arduino labeling scheme.AShelly– AShelly2014年05月09日 14:19:13 +00:00Commented May 9, 2014 at 14:19