Long story short I designed a board around the Atmega1280. Everything works perfectly with the Arduino environment save for one thing… I connected my USB to Serial1 instead of Serial0 so I can’t upload code via USB (only with my AVRISPmkII). So… I need to modify the bootloader.
If someone has (or can make) a bootloader identical to the Arduino Mega with the exception of this small change I would really appreciate it.
Alternatively - if someone is willing to hold my hand I am eager to figure out how to mod the bootloader myself.
Any help is appreciated.
thanks,
-methods
P.S. Modifying the hardware is unfortunately not a viable option… my PCB is totally optimized and I would have to destroy it to swap Serial0/Serial1
Are you using hardware/arduino/bootloaders/atmega/ATmegaBoot_168_atmega1280.hex ?
The source for that (ATmegaBOOT_168.c) has a piece:
#if defined __AVR_ATmega1280__
/* the mega1280 chip has four serial ports ... we could eventually use any of them, or not? */
/* however, we don't wanna confuse people, to avoid making a mess, we will stick to RXD0, TXD0 */
bootuart = 1;
#endif
It looks to me like if you change that to "bootuart = 2" and rebuild, you should get what you want...
1) Try to run "make" from the command prompt, if it wont run add these to your PATH
C:\arduino-0022\hardware\tools\avr\bin
C:\arduino-0022\hardware\tools\avr\utils\bin
2) Navigate to
C:\arduino-0022\hardware\arduino\bootloaders\atmega
3) delete the old hex file, make the change suggested above, and run "make mega" from cmd
Just as easy as pie with a little help.... I have not tested the change yet but that is the easy part XD
If bootuart == 2 you are golden. BUT -> there is some hard coding (poor coding) later on....
#if defined __AVR_ATmega1280__
/* Enable internal pull-up resistor on pin D0 (RX), in order
to supress line noise that prevents the bootloader from
timing out (DAM: 20070509) */
/* feature added to the Arduino Mega --DC: 080930 */
DDRE &= ~_BV(PINE0);
PORTE |= _BV(PINE0);
#endif
Looks like I am going to be spending some time digging on this one to find and check every instance.....
Ok - I thought that would take a while but I got it.
Official success<<<<<<<
Two lines of code must be changed
DDRx sets the direction of the port
PINxx is a const
Change the port from E to D on both
Change the pin from E0 to D2 on both
Apply the change with standard ~&|
#if defined __AVR_ATmega1280__
/* Enable internal pull-up resistor on pin D0 (RX), in order
to supress line noise that prevents the bootloader from
timing out (DAM: 20070509) */
/* feature added to the Arduino Mega --DC: 080930 */
//DDRE &= ~_BV(PINE0);
//PORTE |= _BV(PINE0);
DDRD &= ~_BV(PIND2);
PORTD |= _BV(PIND2);
#endif
Soooo glad I learned assembly back in the day. Who said it would never come in handy???
thanks again for the help - and your welcome to whoever finds this in the future.