Changed External Oscillator Arduino Uno; Board Not Accepting Sketches [SOLVED]

Hi all,

So today, I removed the 16.0MHz external oscillator from my Arduino Uno and replaced it with a 12.0MHz oscillator. It is in the exact same spot as the 16.0MHz oscillator on the Uno.

I had assumed that because the Atmega328p was already using an external clock signal from the 16Mhz crystal, I wouldn't need to mess with any fuse bits if I was simply soldering a different oscillator in its place. I figure if the Atmega was already ready to accept a clock signal from the 16MHz, it shouldn't have a problem accepting a 12MHz signal.

However, since I did this, the board does not appear on my port list on my computer. This made me assume that I had somehow disabled or removed the boot loader (an issue I've handled several times in the past). So I tried to use my Arduino Leonardo as an ISP and burn the boot loader onto the Uno. However, when I did so, I got the following error.

System wide configuration file is "/Users/rhodesconover/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
         User configuration file is "/Users/rhodesconover/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem1421
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Error while burning bootloader.
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

I also went into boards.txt and changed "uno.build.f_cpu=16000000L" to "uno.build.f_cpu=12000000L" so the Arduino IDE knows to expect that the Uno uses 12MHz, not 16MHz.

I feel like I must be missing something obvious (or perhaps less obvious) that is required for the Arduino IDE to be able to upload sketches or burn the boot loader. Does anyone have any insights?

Thanks!

But you have not changed the bootloader to one built for 12MHz. So the bootloader configures the UART baud rate assuming it’s starting from a 16MHz clock instead of a 12MHz one, so the baud rate is 3/4ths what it should be. Hence you are not able to communicate with it over serial, since the adapter you’re connected to is trying to use a different baud rate than the chip is actually using.

Why not install MCUDude’s MiniCore? That has support for the 328p at 12MHz, so you don’t need to rebuild the bootloader yourself (you will still need to reburn bootloader with an ISP programmer, though).

Hi DrAzzy and all,

Sorry for the delay in replying. That makes sense. I was hoping by changing the expected baud rate on my computer's side it would work, but it makes sense that the software on the Arduino's side would be confused by this change.

In fact, I had installed MCUDude's MiniCore for similar reasons prior to making this post, to little avail. However, seeing you recommend it on the forum encouraged me to give it a little more time and attention but I'm still getting a similar error.

Specifically, I chose these settings on for my burn process using the MiniCore:

Board: "ATMega328"
Bootloader: "Yes"
Variant: "328P / 328PA"
BOD: "2.7V"
Clock: "12MHz External"
Compiler LTO: "Disabled (default)
Port: Arduino Leonardo (because this is the board I am using as an ISP)

Programmer: "Arduino as ISP"

I've wired the setup as follows:

  • My Arduino Leonardo is wired to my computer via USB.

  • My Arduino Leonardo has a 10uF capacitor between the Reset Pin and GND.

  • The Uno and Leonardo are connected via ICSP pins:

  • MOSI to MOSI

  • MISO to MISO

  • SCK to SCK

  • 5V to 5V

  • GND to GND

  • RESET to RESET

I select Burn Bootloader with these settings and get the following error:

Arduino: 1.8.5 (Mac OS X), Board: "ATmega328, Yes, 328P / 328PA, 2.7v, Disabled (default), 12 MHz external"

/Users/rhodesconover/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/rhodesconover/Library/Arduino15/packages/MiniCore/hardware/avr/2.0.1/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/cu.usbmodem1411 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0b11110111:m 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/rhodesconover/Library/Arduino15/packages/MiniCore/hardware/avr/2.0.1/avrdude.conf"
         User configuration file is "/Users/rhodesconover/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem1411
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (retrying)

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (retrying)

Error while burning bootloader.
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

I have no idea why this isn't working. Any insights would be very appreciated.
Thank you in advance. :slight_smile:

Pin 10 of Lenorado used as "Arduino as ISP" to Reset of Uno.

@kprims,

Now I feel silly. That was a poor oversight on my part. It works now but only when I used my Arduino Leonardo as a ISP, which is fine. Thank you for your help!

TLDR: Using MCUDude's MiniCore is really helpful for this problem.

Thanks!

since I did this, the board does not appear on my port list on my computer.

So the bootloader configures the UART baud rate assuming it’s starting from a 16MHz clock instead of a 12MHz one, so the baud rate is 3/4ths what it should be. Hence you are not able to communicate with it over serial

Perhaps, but that should not cause the port to “not appear.”
I think he changed the wrong “oscillator”; there are two on an Uno; one for the main CPU, and one for the USB/Serial Conversion chip. If you replaced the crystal on the USB chip instead of the main CPU, USB would stop working, and THAT would make the board disappear from the PC.
This is also consistent with the Other Posting, where it seems that the cpu is still running at 16MHz.
Here’s a picture:
Uno-crystals.jpg

In a Training School, I learnt that the most effective tool for trouble shooting a malfunctioning system is to know first how the system works.

Thanks to @westfw for the great post (Post#5) which echos the same message.

@westfw,

That would certainly explain the issue(s) I'm having quite well. Thank you so much for your clear and helpful response.

It's super important to understand the tech we are working with and that is what makes this platform frustrating. I looked fairly extensively for documentation about the Arduino Uno, but did not find documentation about the Uno having two separate oscillators (one for USB and one for the Atmega). It wasn't until I invested in new oscillators that I found and posted this issue.

Where can I go to find this documentation in advance? I'm down to do the reading. That's what I'm trained to do, I just can't seem to find any useful documentation for stuff like this. I've reviewed the relevant sections of Atmega328p datasheet many times and that has been helpful (I've certainly overlooked a few things in my time). It just feels like I can find documentation about my processor and about the Arduino IDE/programming but anything in between is an undocumented mystery. I'm really grateful to the people on this forum who can point me the right direction but I'd rather be able to read ahead and save everyone's time.

Again: super grateful for the help from westfw (and others)!

rhodesconover:
It’s super important to understand the tech we are working with and that is what makes this platform frustrating. I looked fairly extensively for documentation about the Arduino Uno, but did not find documentation about the Uno having two separate oscillators (one for USB and one for the Atmega). It wasn’t until I invested in new oscillators that I found and posted this issue.

Not exactly correct? This is the official schematic of UNO where 2 crystals are clearly visible – one with ZU4 (ATmega328P) and the other with U3 (ATmega16U2).

Where can I go to find this documentation in advance? I'm down to do the reading. That's what I'm trained to do, I just can't seem to find any useful documentation for stuff like this

Well, the Arduino is "Open Source Hardware", so there is both a schematic and a set of CAD files. Probably you should look at these before you attempt hardware modifications.
In this case, I'll claim you were done in less by lack of documentation, and more by ... misdirection.
The board has one big and obvious crystal with the 'right' frequency marked, and one tiny unidentifiable component that you barely notice. It's somewhat natural to figure "to change to 12MHz, I replace the obvious 16MHz crystal with a 12MHz crystal." Oops.
I don't know of any good "explanations" of the hardware design as a whole. That sort of thing isn't really considered "appropriate" for the normal Arduino audience (there aren't really any explanations of the software internals, either...)

What solution isn’t working?
This particular thread turned out to be about someone trying to change the crystal, and replacing the wrong crystal. Unless you have also replaced a crystal, you have a different problem...