Arduino uno with different X_Tal

I'm building an GPS disciplined 15.6MHz oscillator. This synchronizes the X_tal with the 1pps from an GPS module. I will modify an Uno where I replace the 16MHz X_tal with an 15.6MHz OCXO. The SW is a kind of PLL.

I hope to use the (modified) Arduino bootloader and to make use of the UART.
In my SW I'm not making use of time functions such as delay() or millis().

What do I need to change in the bootloader and in the Sketch such that I can upload my code and the UART functions.

You need to recompile everything with a new definition of the constant F_CPU, which is the clock frequency in Hz.

re jremington,

Thanks for your quick reaction.
In which file(s) should I change the F_CPU vaue ? and how to recompile ?
Can I define a new board definition, as a branch of the Uno ?

You need optiboot.
Maybe this thread is useful: Compiling Optiboot - Microcontrollers - Arduino Forum

Pieter

@PieterP
This Optiboot only works in an Linux environment, right ? my Arduino IDE runs on a windows machine, though not impossible it would mean to me much extra work. Is it not possible to compile a branched bootloader within Arduino IDE on Windows ?

This Optiboot only works in an Linux environment, right ?

Where did you get that idea?

I use Minicore on Win7, which seems to be the most flexible of the Optiboot variants. Follow the installation instructions.

This sounds like a circular problem to me... How are you planning on downloading a new bootloader into the Arduino's flash?

If you can download a new bootloader before downloading & running the new bootloader you should be able to download your sketch...

Maybe you need a stand-alone AVR programmer. Then, you can download your sketch without the bootloader and/or you can download a custom bootloader.

DVDdoug:
If you can download a new bootloader before downloading & running the new bootloader you should be able to download your sketch...

Maarten_pa0mhe:
I hope to use the (modified) Arduino bootloader and to make use of the UART.
...
What do I need to change in the bootloader and in the Sketch such that I can upload my code and the UART functions.

AFAIK, you need the bootloader to be able to upload sketches over UART.

You can easily use a second Arduino to burn the bootloader, no need for an AVR programmer:
https://www.arduino.cc/en/Tutorial/ArduinoISP

I successfully Minicore, BUT I'm back in square one, as the required frequency 15.6MHz option is not available.
Pieter: Can I compile a new bootloader such as your "atmega328_14_7456_isp" in a Win7 environment and how ? I'm not aware of a Make in Windows ?

I'm not sure ... Have you tried it? The Arduino IDE comes with the avr-gcc compiler and some other tools, so maybe it just works?
You could install VirtualBox and create a virtual Ubuntu machine :slight_smile:

If you want, I can send you the compiled firmware.

Pieter

Hi Pieter,

I didn't work in win7.

When I change my HDD my PC runs Ubuntu 16.04, In fact running now from Ubuntu and I just installed Arduino.
However I did not yet found the file location for the bootloader make file.

Yes: it would be of great help if you could compile an atmega328_15_600 bootloader hex file for me, just a normal 328p but only changed into 15600000Hz maarten.heuvelman @ gmail.com

This guide should (more or less) work in Ubuntu 16.04 (haven't tested ever step yet, but it mostly describes what I did to get it work).

Here's a zip with the compiled bootloader. You can just copy the .hex file to /hardware/arduino/avr/bootloaders/optiboot. (Maybe rename it to ..._15_600 to match the boards.txt file)

Pieter

Optiboot ATmega328P 15.6 MHz.zip (8.12 KB)

The guide you wrote is perfect, just what I needed. And it worked fine I have now my Arduino_uno running at an 15.6MHz OCXO. I used the 15.6MHz bootloader you compiled. But in the mean time I see that Optiboot has an Windows "Makefile" omake.bat, I assume that will do the job to do it myselve.
Thanks Maarten

Peter:
I also succeeded to compile a bootfile myselve. This in an Windows environment: for this I needed to install an old versio version of Arduino 1.05 or earlier, these versions still support make for Windows. Before I tried to do it in an Ubuntu environment but there I got stuck in missing (make) file.
The burning of the bootfile, and running an Uno with different frequencies runs perfect!
Anyhow thanks again.

Pieter P:
I needed to make an upgrade to an existing project with a Arduino X-tal on 10MHz. In he mean time my Arduino is upgraded to 1.8.12, and more worse older version are not running anymore.
I tried to Make a new 10MHz Optiboot bootloader for the atmega168p. I downloaded the latest Optiboot from Github, however omake.bat is not working, in fact the make.exe is completely deleted from this new Arduino IDE ?
Compiling code for 10MHz X-tal is still working with a 10MHz entry in boards.txt.
I saw you updated, and maintain, your document "Compiling Optiboot - ATmega328P at custom frequencies" so I hope you can help here.
When possible please contact me direct on maarten.heuvelman at gmail.com
Thanks in advance Maarten

I've never tried it on Windows, and IMHO, it's not worth the hassle. Have you tried it on a Linux machine? You could use a VM or WSL if you don't have access to a real Linux machine.
On Debian and derivatives, you can simply sudo apt install make, the AVR GCC toolchain should be included with the Arduino IDE.