Hello All,
I'm attempting to convert a Mega 2560 to 14.745MHz in order to run the serial at 921.6k baud. I've found a couple of references, but they're not quite the same scenario as I'm in and so I've found myself going in circles trying to figure it out. Most of them seem to be a few years old and are dead ended or missing info:
http://forum.arduino.cc/index.php?topic=62631.0
http://forum.arduino.cc/index.php?topic=61384.0
With this one being the closest but a bit over my head:
http://forum.arduino.cc/index.php?topic=262976.15
So far, I've socketed my board to be able to change crystals:
and made a new entry in boards.txt:
##############################################################
mega2560.name=Arduino Mega 2560 14.7MHz
mega2560.upload.protocol=wiring
mega2560.upload.maximum_size=258048
mega2560.upload.speed=115200
mega2560.bootloader.low_fuses=0xFF
mega2560.bootloader.high_fuses=0xD8
mega2560.bootloader.extended_fuses=0xFD
mega2560.bootloader.path=stk500v2
mega2560.bootloader.file=stk500boot_v2_mega2560_14_7MHz.hex
mega2560.bootloader.unlock_bits=0x3F
mega2560.bootloader.lock_bits=0x0F
mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=14745000L
mega2560.build.core=arduino
mega2560.build.variant=mega
The next step looks to be to modify the stk500boot.c file, but this is where I get stuck... not sure what to do here. The only example I could find was for an ATmega 168. This is all I've been able to spot in that file, at line 228:
/*
* define CPU frequency in Mhz here if not defined in Makefile
*/
#ifndef F_CPU
#define F_CPU 14745000UL
#endif
Then after that I believe I need to go after the makefile, but I haven't gotten that far yet.
I have, at my disposal, an UNO and a Sparkgun FTDI Basic to use for burning the new bootloader when I get that far.
Also, I'm wondering, since I can readily switch the crystals...
Is there any chance I can simply define the clock speed within the sketch, use the 16MHz crystal to upload as normal, swap to 14.7MHz, and go? Seems too simple to be true, but a guy can dream
Any guidance is appreciated. Thanks!