Send out an internal clock signal?

Hi,
I would like to use our beloved Atmega 328p together with another piece of hardware that is connected via SPI and needs a 8Mhz crystal.

I would like to run my atmega on its internal clock (8MHz).

Is there a way to send this clock signal out from the Atmega and use it also for my spi device?

Or do I need a hardware crystal?

thanks!

You might be able to set up one of the timer/counters to count up from 0 to 1 and use an output compare to generate a clock signal but I think you will have a 4MHz clock output if your system clock is 8MHz. I could also be wrong about this whole approach.

You'll have to do more research but I found something on the datasheet. Port B bit-0 can be configured as a clock output (that's pin 14 on the DIP package.

9.9
Clock Output BufferThe device can output the system clock on the CLKO pin. To enable the output, the CKOUT Fuse has to be programmed. This mode is suitable when the chip clock is used to drive other circuits on the system. The clock also will be output during reset, and the normal operation of I/O pin will be overridden when the fuse is programmed. Any clock source, including the internal RC Oscillator, can be selected when the clock is output on CLKO. If the System Clock Prescaler is used, it is the divided system clock that is output.

14.3.1 Alternate Functions of Port B...

...ICP1/CLKO/PCINT0 – Port B, Bit 0

ICP1, Input Capture Pin: The PB0 pin can act as an Input Capture Pin for Timer/Counter1.CLKO, Divided System Clock: The divided system clock can be output on the PB0 pin. The divided system clock will be output if the CKOUT Fuse is programmed, regardless of the PORTB0 and DDB0 settings. It will also be output during reset.

@DVDdoug, that's pretty cool and could come in useful to save a bit of board space instead of another crystal.

Supercool! so we can actually build these szstems withoutanother crystal

This assumes that your mystery device doesn't require the timing accuracy of a quartz crystal. The internal oscillator is not very accurate at all, compared with those.

But but

Any clock source, including the internal RC Oscillator, can be selected when the clock is output on CLKO.

I got interested in this odd capability when I read that…

a7