Using other external oscillator than original

Hi, my board has a 12 MHz external crystal but I need 16 MHz for a library to work. I ordered 16MHz crystals, is there a way to use them instead of the soldered 12MHz?

You can certainly "unsolder" the 12 MHz crystal, and replace it with a 16 MHz crystal.

However, if the firmware on the board is configured for a 12 MHz clock, some things won't work correctly after the switch (for example, the bootloader).

Do you have a pointer for me to understand what to do to correctly replace the crystal and do the things for it to work including bootloader and other "some" things?

All the Arduino code that requires specific timing (like the bootloader, serial port routines, millis(), etc.) depends on the parameter F_CPU, which must be set (somewhere) to the number of CPU clock cycles per second.

The external quartz is usually identical with the maximum speed the processor can run on.

What processor is on your board?

What kind of board is it?

What kind of crystal is it? Unfortunately, many of the commercial boards (including the official ones - one of numerous design decisions that I would not have made) use tiny SMD resonators which are difficult to replace at home - and give less accurate timing too.

my board has a 12 MHz external crystal

Are you sure? Many "clone" boards have a 12MHz crystal for the USB/Serial chip (ie CH340g), but still have a 16MHz crystal or resonator for the AVR itself. 12MHz is a pretty unusual frequency for an Arduino-like board, or even for a generic AVR...

Thank you everybody for the help.

Microcontroller is atmega 2560, I got it on aliexpress. It is the kinda big crystal you see the 12.000 on it.

Also westfw I think you solved the problem because I was unaware of this. I see the 12 Mhz crystal connected to the CH340g. However now I don't know if my board has an oscillator or resonator at all.

It does, tiny little silvery thing right next to the chip ( a ceramic resonator - not readily replaceable, and likely 16mhz anyway)

Here's a picture. (A Mega Clone I found on eBay. YMMV.) Actually, it looks a little funky; usually if there is a resonator, you wouldn't need the extra caps. And I'd be happier if it were closer to the chip...
Leave it to China to populate ALL of the parts, even the ones that are supposed to be left out under some circumstances...

westfw and DrAzzy are probably right. You could be looking at the USB/Serial crystal.

The clock/crystal/resonator for the MCU is tiny, and not far away from the 3.3volt/5volt pins.
Leo..

Allright thanks, I have the same board configuration as the picture you linked. The 16 MHz crystals I ordered won't be wasted though, I will use them as external oscillators for some attinies :slight_smile:

arduinoaleman:
The external quartz is usually identical with the maximum speed the processor can run on.

Not true. The Uno at 16MHz has the ATMega328p, which is rated for a max clock of 20MHz. But the Uno has a 16MHz crystal on it.

The lowest voltage the AVR can run on goes up with the clock frequency.

http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf

https://www.arduino.cc/en/Main/ArduinoBoardUno

On the other hand, the ATmega2560 on the Mega is only rated for 16MHz.