m
m
Line 23: Line 23:
 
!Register || Description
 
!Register || Description
 
|-
 
|-
|SPCR|| Contains the recently received Data
+
|SPCR|| SPI Control Register
 
|-
 
|-
|SPSR|| Contains the data to be transmitted
+
|SPSR|| Contains the data to be transmitted : used to configure SPI
 
|-
 
|-
|SPDR|| FIFO Control Register
+
|SPDR|| SPI Data Register : contains received data  or data to be transmitted
 
|-
 
|-
|SPCCR|| Controls the UART frame formatting(Number of Data Bits, Stop bits)
+
|SPCCR|| SPI Clock Counter Register : used to control master SCK frequency
|-
+
|DLL|| Least Significant Byte of the UART baud rate generator value.
+
|-
+
|DLM|| Most Significant Byte of the UART baud rate generator value.
+
 
|}
 
|}
 
<br><br>
 
<br><br>

Revision as of 19:07, 16 June 2015


Objective

LPC1768 SPI Block

The below block diagram shows the SPI input pins multiplexed with other GPIO pins.
The SPI pin can be enabled by configuring the corresponding PINSEL register to select SPI function.
When the SPI function is selected for that pin in the Pin Select register, other Digital signals are disconnected from the SPI input pins.

Port Pin Pin Number PINSEL_FUNC_0 PINSEL_FUNC_1 PINSEL_FUNC_2 PINSEL_FUNC_3
P0.15 47 GPIO TXD1 SCK0 SCK
P0.16 48 GPIO RXD1 SSEL0 SSEL
P0.17 46 GPIO CTS1 MISO0 MISO
P0.18 45 GPIO DCD1 MOSI0 MOSI

SPI Registers

Register Description
SPCR SPI Control Register
SPSR Contains the data to be transmitted : used to configure SPI
SPDR SPI Data Register : contains received data or data to be transmitted
SPCCR SPI Clock Counter Register : used to control master SCK frequency



SPI Register Configuration

Steps for using SPI

Initialize SPI

Send Data

Receive Data

Code

Example 1

Using Explore Embedded Libraries