Arduino Uno clocking

In reading up the Atmega328 specs, it talks a fair bit about clocking on PB6 & 7. All the Uno schematics I’ve seen use and external crystal into PB6/7 but I’m not sure that’s necessary.

From the Specs: “The device is shipped with internal RC oscillator at 8.0MHz and with the fuse CKDIV8 programmed, resulting in 1.0MHz system clock. The startup time is set to maximum and time-out period enabled. (CKSEL = “0010”, SUT = “10”, CKDIV8 = “0”). The default setting ensures that all users can make their desired clock source setting using any available programming interface.”

3 Likes

Hi Gerard,

Did you mean to post this as a new topic? Were you replying to something?

FYI, Nick Gammon has some great info on the different timers on board the 328P here:
https://www.gammon.com.au/timers

And here’s a document on calibrating the internal oscillator:

2 Likes

New topic. It relates back to a design I started last year but Uni got in the way.

4 Likes

I need a fair few digital pins and also need to minimise my component count.

:frowning:

4 Likes

Hey Gerard,

If you just need IO would an expander work? Check out Zack Freedmans keyboard for a massive one: I Invented a Keyboard and Snapped it in Half (MiRage Mech Keyboard) - YouTube
Core stocks one with 16 channels here on a breakout board: https://core-electronics.com.au/adafruit-aw9523-gpio-expander-and-led-driver-breakout-stemma-qt-qwiic.html

4 Likes

The atmega can run off an internal oscillator - no problem
Precise timing from a crystal is useful if you intend to use UART - which has stricter timing requirements than the oscillator can provide (at higher baudrates).

Put simply, if you want to use UART at > 9600baud then you’ll likely need an external crystal. Otherwise you’re good to go!

5 Likes

Thanks Liam, Michael,

That’s pretty helpful info.

I removed the UART from the schematic and will plug the UART in at programming time.

:slight_smile:

Gerard

2 Likes

Atmega328P definitely works with internal RC oscillator.
Can confirm from personal experience. Once tried to make a clock with minimal number of components. Could never get it as accurate as a bedside clock, but it did work.

I used the ICSP interface to load programs, if I remember right.
The bootloader needs to be changed if you change from the standard 16MHz crystal.

If you need more GPIO pins you could try the Atmega32U4 or an Atmega 2560 board.
Really depends on what you want to do and what facilities you have access to.
There are a number of boards with the Atmega32U4 that may work for you.

Cheers
Jim

5 Likes

Hey All,

I finished the schematic and the number of IO pins worked out such that I can leave the crystal in place. I ended up using an LM324 to do some of the error detection I built in. I used MultiSim to do some simulation which is a pretty handy tool.

:slight_smile:

3 Likes