atmega161-4pi ATMEL Corporation, atmega161-4pi Datasheet - Page 67

no-image

atmega161-4pi

Manufacturer Part Number
atmega161-4pi
Description
8-bit Microcontroller With 16k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
SPI Status Register – SPSR
1228D–AVR–02/07
• Bits 1, 0
These two bits control the SCK rate of the device configured as a Master. SPR1 and
SPR0 have no effect on the Slave. The relationship between SCK and the Oscillator
Clock frequency (f
Table 23. Relationship between SCK and the Oscillator Frequency
Note:
• Bit 7
When a serial transfer is complete, the SPIF bit is set (one) and an interrupt is gener-
ated if SPIE in SPCR is set (one) and global interrupts are enabled. If SS is an input and
is driven low when the SPI is in Master mode, this will also set the SPIF Flag. SPIF is
cleared by hardware when executing the corresponding Interrupt Handling Vector. Alter-
natively, the SPIF bit is cleared by first reading the SPI Status Register with SPIF set
(one), then by accessing the SPI Data Register (SPDR).
• Bit 6
The WCOL bit is set if the SPI Data Register (SPDR) is written during a data transfer.
The WCOL bit (and the SPIF bit) are cleared (zero) by first reading the SPI Status Reg-
ister with WCOL set (one), and then by accessing the SPI Data Register.
• Bits 5..1
These bits are reserved bits in the ATmega161 and will always read as zero.
• Bit 0
When this bit is set (one), the SPI speed (SCK frequency) will be doubled when the SPI
is in Master mode (see Table 23). This means that the maximum SCK period will be two
CPU clock periods. When the SPI is configured as Slave, the SPI is only guaranteed to
work at f
The SPI interface on the ATmega161 is also used for Program memory and EEPROM
downloading or uploading. See page 125 for serial programming and verification.
Bit
$0E ($2E)
Read/Write
Initial Value
SPI2X
1. When the SPI is configured as Slave, the SPI is only guaranteed to work at
0
0
0
0
1
1
1
1
cl
SPIF: SPI Interrupt Flag
WCOL: Write Collision Flag
SPI2X: Double SPI Speed Bit
/4.
SPR1, SPR0: SPI Clock Rate Select 1 and 0
Res: Reserved Bits
SPIF
R
7
0
cl
) is shown in Table 23:
WCOL
SPR1
R
6
0
0
0
1
1
0
0
1
1
R
5
0
SPR0
R
4
0
0
1
0
1
0
1
0
1
R
3
0
R
2
0
ATmega161(L)
SCK Frequency
R
1
0
f
(1)
f
f
f
f
cl
f
f
f
cl
cl
cl
cl
cl
/128
cl
cl
/16
/64
/32
/64
/4
/2
/8
SPI2X
R/W
0
0
f
cl
/4.
SPSR
67

Related parts for atmega161-4pi