Professional Documents
Culture Documents
T. Revathi
trevathi@vit.ac.in
TIFAC-CORE in Automotive Infotronics
Course outline
Preliminary
Concepts
SSI
Features In
ARM
SSI
Implementation
Preliminary Concepts
Why SPI ?
Master and Slave Concept.
High Data Rate.
Data synchronization.
Cost Effective (No Driver Support).
What - SPI ?
SPI is a synchronous serial protocol proposed by Motorola
to be used as standard for interfacing peripheral chips to a
microcontroller.
It is a synchronous serial data link that operates in full
duplex (signals carrying data go in both directions
simultaneously).
Data is clocked along with the clock signal (SCK).
SPI
Devices are classified into the master or slaves.
The SPI protocol uses four wires to carry out the task of
data communication:
MOSI: Master out slave in
MISO: Master in slave out
Applications
Shift registers.
Phase locked loop chips.
Memory components with SPI interface, or
A/D or D/A converter chips.
Synchronous Serial
Interface in Cortex
About
Stellaris microcontroller includes Four Synchronous Serial Interface (SSI) modules.
Each SSI module is a master or slave interface for synchronous serial communication
with peripheral devices that have either Freescale SPI, MICROWIRE, or Texas
About
Programmable data frame size from 4 to 16 bits
Internal loopback test mode for diagnostic/debug testing
Standard FIFO-based interrupts and End-of-Transmission interrupt
Efficient transfers using Micro Direct Memory Access Controller (DMA)
Separate channels for transmit and receive
Receive single request asserted when data is in the FIFO; burst request
asserted when FIFO contains 4 entries
Transmit single request asserted when there is space in the FIFO; burst
request asserted when four or more entries are available to be written in
the FIFO
SSI Signals
Interrupts in SSI
Implementation Steps
Step 1 : Set the Clock Source
Step 2 : Select the peripheral and port associated with the
peripheral
Step 3 : Select the alternate function of the Pin
Step 4 : Configure IO Pins to use as SSI Pins
Step 5 : Configure SSI
Step 6 : Check if there is any data in the receive FIFO
Step 7 : Put the data to FIFO for transmit
Step 8 : Wait until data is transferred to the transmit FIFO
Prototype:
void SysCtlClockSet(unsigned long ulConfig)
Parameters:
ulConfig is the required configuration of the device
clocking.
Description:
This function configures the clocking of the device.
The input crystal frequency, oscillator to be used, use of the
PLL, and the system clock divider are all configured with
this function.
Enables a peripheral.
Prototype:
void SysCtlPeripheralEnable(unsigned long
ulPeripheral)
Parameters:
ulPeripheral is the peripheral to enable.
Description:
Peripherals are enabled with this function.
At power-up, all peripherals are disabled; they must
be enabled in order to operate or respond to register
reads/writes.
Prototype:
void GPIOPinConfigure(unsigned long ulPinConfig)
Parameters:
ulPinConfig is the pin configuration value, specified as only one of the
GPIO_P??_??? values.
Description:
This function configures the pin mux that selects the peripheral function
associated with a particular GPIO pin.
Only one peripheral function at a time can be associated with a GPIO pin,
and each peripheral function should only be associated with a single GPIO
pin at a time .
To fully configure a pin, a GPIOPinType() function should also be called.
The SSI pins must be properly configured for the SSI peripheral to
function correctly.
This function provides a typical configuration for those pin(s); other
configurations may work as well depending upon the board setup
(for example, using the on-chip pull-ups).
The pin(s) are specified using a bit-packed byte, where each bit that
is set identifies the pin to be accessed.
Prototype:
void SSIConfigSetExpClk(unsigned long ulBase,unsigned long
ulSSIClk, unsigned long ulProtocol, unsigned long
ulMode,unsigned long ulBitRate, unsigned long ulDataWidth)
Parameters:
Description:
Modes of operation
Polarity
0
0
1
1
Phase
0
1
0
1
Mode
SSI_FRF_MOTO_MODE_0
SSI_FRF_MOTO_MODE_1
SSI_FRF_MOTO_MODE_2
SSI_FRF_MOTO_MODE_3
Mode 0
Mode 1
Mode 2
Mode 3
Prototype:
long SSIDataGetNonBlocking(unsigned long ulBase,
unsigned long *pulData)
Parameters:
ulBase specifies the SSI module base address.
Prototype:
void SSIDataPut(unsigned long ulBase,unsigned long
ulData)
Parameters:
ulBase specifies the SSI module base address.
ulData is the data to be transmitted over the SSI
interface.
Description:
This function places the supplied data into the transmit
FIFO of the specified SSI module.
If there is no space available in the transmit FIFO, this
function waits until there is space available before
returning.
Prototype:
tBoolean SSIBusy(unsigned long ulBase)
Parameters:
ulBase is the base address of the SSI port.
Description:
This function allows the caller to determine whether
all transmitted bytes have cleared the transmitter
hardware.
If false is returned, then the transmit FIFO is empty
and all bits of the last transmitted word have left the
hardware shift register.