BACKGROUND
I have made my own Arduino PCB based on the circuit of the Arduino Pro Mini (below) (including the external oscillator).
Picture of Arduino Pro Mini
I have already written the firmware and the code is stable. The code uses the millis()
function which uses Timer 0. I also have changed the frequency of the PWM output on pins 3, 9, 10, 11, using the clock select bits (bits 2:0 in TCCR1B & TCCR2B). See http://playground.arduino.cc/Main/TimerPWMCheatsheet
I have an ISP 6-pin programming port on the board and this is my only method of uploading code.
I want minimize on components (and avoid EMC issues), so I have been considering removing the external 16MHz crystal and instead using the internal 8MHz oscillator.
QUESTIONS
- What do I need to change to use the internal oscillator?
I suspect that I need to change the board.txt file, the clock select bits and the fuses to accommodate for the new frequency.
Can I leave the external crystal in place or do I have to remove it?
If I do leave the external crystal in place and set the fuses to use the internal oscillator, will the crystal continue to resonate or does it get powered down somehow?
(I wish to know this for EMC reasons)
-
1Maybe this?? instructables.com/id/…Dat Ha– Dat Ha2016年10月19日 17:46:17 +00:00Commented Oct 19, 2016 at 17:46
-
"internal 8MHz crystal" AVRs don't have one of those. Also, that's not a crystal on that board either.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2016年10月19日 18:22:27 +00:00Commented Oct 19, 2016 at 18:22
1 Answer 1
- What do I need to change to use the internal oscillator?
You'll need to change the fuses on the chip, and you probably want a new 8MHz entry in boards.txt
so that timing functions still work as expected.
Can I leave the external [resonator] in place or do I have to remove it?
If I do leave the external [resonator] in place and set the fuses to use the internal oscillator, will the [resonator] continue to resonate or does it get powered down somehow? (I wish to know this for EMC reasons)
From the datasheet:
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7...6 is used as TOSC2...1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.
Also:
When AS2 is set, pins TOSC1 and TOSC2 are disconnected from Port B. A crystal can then be connected between the TOSC1 and TOSC2 pins to serve as an independent clock source for Timer/Counter2. The Oscillator is optimized for use with a 32.768kHz crystal.
Therefore if AS2
is not set, the two pins act as normal GPIOs and the resonator is disabled.
Explore related questions
See similar questions with these tags.