How do you change the speed of the spi clock?

Section 18.5 of the datasheet (page 169) explains the SPI registers. Bits 0 and 1 (SPR0 and SPR1) of the SPI control register SPCR determine the SPI clock frequency as a function of the oscillator clock frequency. Bit 0 (SPI2X) of the SPI status register SPSR will double the SPI clock frequency if set. Together these three bits allow you to select from seven different SPI clock frequencies between Fosc/2 (8 MHz) and Fosc/128 (125 kHz).

  • Ben