dsPIC30F Family Reference Manual
DS70272B-page 35-16 © 2008 Microchip Technology Inc.
The SPI1 module supports two framed modes of operation. In Framed Master mode, the SPI1
module generates the frame synchronization pulse and provides this pulse to other devices at
the SS1 pin. In Framed Slave mode, the SPI1 module uses a frame synchronization pulse
received at the SS1 pin.
The following four Framed SPI modes are supported in conjunction with the unframed Master
and Slave modes:
• SPI Master, Frame Master
• SPI Master, Frame Sl ave
• SPI Slave, Frame Maste r
• SPI Slave, Frame Slav e
These modes determine whether or not the SPI1 module generates the serial clock and the
frame synchronization pulse.
When FR MEN ( SPI1C ON 2<1 5>) = 1 an d M STEN (SPI1 CON 1 <5> ) = 1, t he SC K1 pin be co me s
an output and the SPI clock at SCK1 becomes a free running clock.
When FRMEN = 1 and M STEN = 0, the SCK1 pin becomes an input. The source clock provided
to the SCK1 pin is assumed to be a free running clock.
The polarity of the clock is selected by the CKP (SPI1CON1<6>) bit. The CKE (SPI1CON1<8>)
bit is not used for the Framed SPI modes and should be programmed to ‘0’ by the user
application.
When CKP = 0, the frame synchronization pulse output and the SDO1 data output change on
the rising edge of the clock pulses at the SCK1 pin. Input data is sampled at the SDI1 input pin
on the falling edge of the serial clock.
When CKP = 1, the frame synchronization pulse output and the SDO1 data output change on
the falling edge of the clock pulses at the SCK1 pin. Input data is sampled at the SDI1 input pin
on the rising edge of the serial clock.
35.3.3.1 Frame Master and Frame Slave Modes
When SPIFSD (SPI1CON2<14>) = 0, the SPI1 module is in the Frame Master mode of
operat ion. In this mo de, the frame sy nc pulse is init iated by the mo dule when the us er applicat ion
writes the transmit dat a to the SPI1BUF loc ation (thus writ ing the SPI1TXB register w ith transmit
data). At the end of the frame synchronization pulse, the SPI1TXB is transferred to the SPI1SR
and data transmission or reception begins.
When SPIFSD = 1, the module is in Framed Slave mode. In this mode, the frame synchronization
pulse is generated by an external source. When the module samples the frame synchronization
pulse, it will transfer the contents of the SPI1TXB register to the SPI1SR and data transmission
or reception begins. The user application must make sure that the correct transmission data is
loaded into the SPI1BUF before the frame synchronization pulse is received.
Note: The use of the SS1 and SCK1 pins is mandatory in all Framed SPI modes.
Note: Receiving a frame synchronization pulse will start a transmission regardless of
whether data was written to SPI1BUF. If no write was performed, the old contents of
the SPI1TXB will be transmitted.