1 MC
1 MC
UART 8L+8T+8P=24Hrs
USB
0 < MULVAL ≤ 15
0 ≤ DIVADDVAL ≤ 15
Registers
Registers
Max-232 is a IC used
to make the voltage
compatible between
RS232 and TTL logic.
Configuring an Interrupt
• Enable global interrupts
• Set the priority of the interrupt
• Enable the interrupts we want to use
• Programs can handle 1 FIQ, 16 VIRQ,
1 NVIRQ Interrupt sources
VIC…… Software Interrupt register (VICSoftInt)
Read/Write register, 22 interrupt sources are there here.
Bit# 31 30 29 28 27 26 25 24
IRQ - - - - - - - -
Bit# 23 22 21 20 19 18 17 16
IRQ - USB AD1 BOD I2C1 AD0 EINT3 EINT2
Bit# 15 14 13 12 11 10 9 8
IRQ EINT1 EINT0 RTC PLL SPI1/SSP SPI0 I2C0 PWM
Bit# 7 6 5 4 3 2 1 0
IRQ UART1 UART0 TIMR1 TIMR0 ARMC1 ARMC0 - WDT
Dr. V.Vijayaraghavan, Associate Professor-ECE, VFSTR, Guntur
VIC…… Interrupt registers
Software Interrupt Clear register (VICSoftIntClear)
void initClocks(void)
{
PLL0CON = 0x01; //Enable PLL
PLL0CFG = 0x24; //Multiplier and divider setup
PLL0FEED = 0xAA; //Feed sequence
PLL0FEED = 0x55;
while(!(PLL0STAT & 0x00000400)); //is locked?
PLL0CON = 0x03; //Connect PLL after PLL is locked
PLL0FEED = 0xAA; //Feed sequence
PLL0FEED = 0x55;
VPBDIV = 0x01; //PCLK is same as CCLK i.e.60 MHz
}
Interrupt Programming…..
#include <lpc214x.h>
#include <stdint.h>
char rx;
__irq void UART0_Interrupt(void);
void UART0_init(void)
{
PINSEL0 = PINSEL0 | 0x00000005;
U0LCR = 0x83;
U0DLM = 0x00; /* baud rate 9600,Pclk 15MHz */
U0DLL = 0x61;
U0LCR = 0x03; /* DLAB = 0 */
U0IER = 0x00000003;/* Enable THRE and RBR interrupt */
}
__irq void UART0_Interrupt(void)
{ int main(void)
int iir_value; {
iir_value = U0IIR; UART0_init();
while ( !(iir_value & 0x01) ); VICVectAddr0 = (unsigned) UART0_Interrupt;
if( iir_value & 0x00000004 ) VICVectCntl0 = 0x00000026; /* UART0 IRQ slot */
{ rx = U0RBR; } VICIntEnable = 0x00000040; /* UART0 interrupt */
U0THR = rx; VICIntSelect = 0x00000000; /* UART0 config as IRQ */
while( (U0LSR & 0x40) == 0 ); while(1);
VICVectAddr = 0x00; }
}
Universal Serial Bus
(USB)
USB (Universal Serial Bus) USB 2.0 device controller
The USB is a 4-wire serial bus that supports communication between a host and a
number (127 max) of peripherals.
The host controller allocates the USB bandwidth to attached devices through a
token based protocol.
The bus supports hot plugging, unplugging, and dynamic configuration
of the devices. All transactions are initiated by the host controller.
The LPC2148 is equipped with a USB device controller that enables
12 Mbit/s data exchange with a USB host controller.
It consists of a register interface, serial interface engine, endpoint buffer memory
and DMA controller.
The serial interface engine decodes the USB data stream and writes data to the
appropriate end point buffer memory. The status of a completed USB transfer or error
condition is indicated via status registers. An interrupt is also generated if enabled.
A DMA controller can transfer data between an endpoint buffer and USB RAM.
USB…..
The host schedules transactions in 1 ms frames. Each frame
contains SoF marker and transactions that transfer data to/from
device endpoints. Each device can have a maximum of 16 logical or
32 physical endpoints.
There are 4 types of transfers defined
The control transfers are used to configure the device.
The interrupt transfers are used for periodic data transfer.
The bulk transfers are used when rate of transfer is not critical.
The isochronous transfers have guaranteed delivery time but no error
correction.
Double buffer implementation for bulk and isochronous endpoints
USB Pins:
D+, D-, VBUS, UP_LED, CONNECT
These two functions (SoftConnect and GoodLink LED indicator) are sharing one pin.
USB….. Fixed Endpoint Configuration….
USB….. Fixed Endpoint Configuration….
USB….. USBTxData & USBRxData Registers
USB….. USBCtrl Register
USB….. USBCmdCode & USBCmdData Registers
This register is used for writing the commands. The commands written here will get
propagated to the Protocol Engine and will be executed there. After executing the command,
the register will be empty, and the “CCEMTY” bit of the Interrupt Status register is set high.
This is a read-only register which will carry the data retrieved after executing a command.
When this register is ready, the “CD_FULL” bit of the Device Interrupt Status register is set.
USB….. Registers List
USB….. Block diagram
USB…..
Data Flow:
USB is a host controlled protocol, i.e., irrespective of whether the data
transfer is from the host to the device or device to the host, transfer
sequence is always initiated by the host.
During data transfer from device to the host, the host sends an IN token
to the device, following which the device responds with the data.
It supports 32 physical (16 logical) endpoints.
Data Flow from USB Host to the Device.
Data Flow from Device to the Host.
Slave Mode Transfer.
DMA Mode Transfer.
I2C-pin Description
Pin Type Description
Dr. V. VIJAYARAGHAVAN,
Associate Professor - ECE,
VFSTR (Deemed to be University),
Vadlamudi, Guntur, AP.