Industrial Reference Design Platform RS-232 Interface Developed by the TSC Americas Release 1.0.

Slides:



Advertisements
Similar presentations
INPUT-OUTPUT ORGANIZATION
Advertisements

Review: Interrupts & Timers
PROGRAMMABLE PERIPHERAL INTERFACE -8255
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Programmable Interval Timer
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati.
ECT 357 Ch 18 UART. Today’s Quote: Be careful that your marriage doesn’t become a duel instead of a duet. Be careful that your marriage doesn’t become.
Microprocessor and Microcontroller
Serial I/O - Programmable Communication Interface
ARM development environment Modified Content Philips LPC2106 ARM chip ARM target board PSPad customised development environment Troubleshooting.
Better Debugging of Embedded via a Debug Port ECE152.
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
USART and Asynchrono us Communica tion The USART is used for synchronous and asynchronous serial communication. USART = Universal Synchronous/Asynchronous.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Aztec PC Oscilloscope Michael Mason Jed Brown Josh Price Andrew Youngs.
Serial Communications Standards (Partly Excerpted from Simpl Primer) Cabling Configuration Protocol.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Lecture 10 Serial Communication.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 13.
INPUT-OUTPUT ORGANIZATION
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
Serial Communication ETEC 6416.
Silicon Labs ToolStick Development Platform
1 ECE243 I/O Hardware. 2 ECE243 Basic Components.
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
SC200x Peripherals Broadband Entertainment Division DTV Source Applications July 2001.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
8254 Programmable Interval Timer
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
Lecture 7 Universal Asynchronous Receiver/Transmitter (UART) NCHUEE 720A Lab Prof. Jichiang Tsai.
8254 SOFTWARE PROGRAMMABLE TIMER/COUNTER
3-1 Digital I/O A group of I/O pins is called a PORT  A port is where data enters/leaves the system. Digital I/O pins are usually grouped into 8,16 or.
MICROPROCESSOR INPUT/OUTPUT
Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6.
Universal Asynchronous Receiver/Transmitter (UART)
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
Microprocessors 2 lesson Subjects lesson 7 Planning Interrupts Serial communication /USART Questions.
UART: Universal Asynchronous RX/TX
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
NS Training Hardware. Serial Controller - UART.
8279 KEYBOARD AND DISPLAY INTERFACING
Universal Asynchronous Receiver/Transmitter (UART)
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
7 - 1 Texas Instruments Incorporated Module 7 : Serial Peripheral Interface C28x 32-Bit-Digital Signal Controller TMS320F2812.
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
8279 KEYBOARD AND DISPLAY INTERFACING
This material exempt per Department of Commerce license exception TSU Architecture Wizard and PACE Lab 2 Introduction.
8255:Programmable Peripheral Interface
Lab Environment and Miniproject Assignment Spring 2009 ECE554 Digital Engineering Laboratory.
ECE 554 Miniproject Spring
8251 USART.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
SMS Based Industrial Automation Using ARM Controller Under the guidance of : Smt Jayanthi.K.Murthy Assistant Professor, PG Studies, Dept of E&C, BMSCE,
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names.
AGRICULTURAL MONITORING BASED ON WIRELESS SENSOR NETWORK TECHNOLOGY Adithya engineering college M.V.Sireesha Internal guide 09a91d5507 M.S.R.Shekar Associate.
Lecture # 14. RS – 232C Standard Standard for physical dimensions of the connectors. PC (DTE) Modem RS – 232C Cable Connected via serial port (DCE)
The 8085A is a general-purpose microprocessor with low hardware overhead requirements. Within the 8085A are contained the functions of clock generation,
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
Homework Reading Machine Projects
Serial mode of data transfer
CS-401 Computer Architecture & Assembly Language Programming
PC Mouse operated Electrical Load Control Using VB Application
Homework Reading Machine Projects Labs
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
NS Training Hardware.
Presentation transcript:

Industrial Reference Design Platform RS-232 Interface Developed by the TSC Americas Release 1.0

TSC Americas – IRD Platform – RS-232 Interface 2 LPC2468 UARTs Functional Overview There are 4 UARTS available on the LPC2468 UART functionality –16 byte Receive and Transmit FIFOs –Register locations conform to industry standard 16C550 UART –Receiver FIFO trigger points at 1, 4, 8, and 14 bytes –Fractional divider for baud rate control, auto-baud capabilities and mechanism that enables software flow control implementation –UART1 allows for implementation of either software or hardware flow control –UART3 includes an IrDA mode to support infrared communication –Maximum possible speed of the UART – 4.5Mb/s

TSC Americas – IRD Platform – RS-232 Interface 3 SCR Scratch Pad Register LCR Line Control Register LSR Line Status Register FIFO Control Register LPC2468 UARTs 0, 2, and 3 Block Diagram

TSC Americas – IRD Platform – RS-232 Interface 4 LSR Line Status Register LCR Line Control Register SCR Scratch Pad Register FIFO Control Register LPC2468 UART 1 Block Diagram

TSC Americas – IRD Platform – RS-232 Interface 5 LPC2468 UARTs Baud Rate Generators Note: For DLLSB, a 0x00 value is treated like a 0x01 value, as division by zero is not allowed

TSC Americas – IRD Platform – RS-232 Interface 6 LPC2468 UARTs Fractional Baud Rate Generator (Available on Enhanced UARTs) Accurate Baud Rate Generation from a wide range of Crystal Frequencies UnDL is value determined by the UnDLM and UnDLL registers (UnDL = 256 × UnDLM + UnDLL) DIVADDVAL and MULVAL are UARTn fractional baud-rate generator specific parameters specified in the Fractional Divisor (UnFDR) register PCLK is the peripheral clock frequency set for the specific UART in the PCLKSELn register (Peripheral clock divisors can be set differently for individual peripherals in the LPC23/24xx)

TSC Americas – IRD Platform – RS-232 Interface 7 LPC2468 UARTs Fractional Baud Rate Generator Registers The value of MULVAL and DIVADDVAL should comply to the following conditions: 0 < MULVAL ≤ 15 0 ≤ DIVADDVAL ≤ 15

TSC Americas – IRD Platform – RS-232 Interface 8 LPC2000 Family UART Fractional Baud Rate Calculator Tool

TSC Americas – IRD Platform – RS-232 Interface 9 IRD RS-232 Interface Implementation UART0 and UART1 provide RS-232 interfaces with DB9 connectors UART2 is pinned out to JP1-7(Tx) and JP1-9 (Rx) UART3 is pinned out to expansion header JP3-4(Tx) and JP3-1(Rx) UART0 also functions as a programming interface for ISP

TSC Americas – IRD Platform – RS-232 Interface 10 DCEDTE JP9 (UART0) 1-2 * 3-4 * JP12 (UART1) * 3-4 * DTE/DCE Flexibility * = Default Configuration IRD RS-232 Interface Schematic DTE/DCE Selection

TSC Americas – IRD Platform – RS-232 Interface 11 UART 0 Used for In System Programming ISPDefault J J81-2- J91-2,3-4 IRD RS-232 Interface Schematic In System Programming (ISP)

TSC Americas – IRD Platform – RS-232 Interface 12 IRD RS-232 Interface Software UART Initialization Flowchart Declare Local Variables Init Local Variables Set Up I/O Registers Init Baud Rate Registers Init UART 0 or 1? Init Interrupt mode Init Serial Mode Init FIFO mode Init Local Variables Set Up I/O Registers Init Baud Rate Registers Init Interrupt mode Init Serial Mode Init FIFO mode UART0 UART1

TSC Americas – IRD Platform – RS-232 Interface 13 IRD RS-232 Interface Software UART Write Function Flowchart UART 0 or 1? Load U0THR with Byte to Transmit Is U0THR Empty? Load U1THR with Byte to Transmit Is U1THR Empty? UART0 UART1

TSC Americas – IRD Platform – RS-232 Interface 14 IRD RS-232 Interface Software UART Read Function Flowchart UART 0 or 1? Get Received Byte From U0RBR Register Is U0 RDR Bit Set? Get Received Byte From U1RBR Register Is U1 RDR Bit Set? UART0 UART1

TSC Americas – IRD Platform – RS-232 Interface 15 IRD RS-232 Interface Software UART0 Initialization Code void Ser_Init (void) { CPU_INT16U divisor; /* Baud rate divisor */ CPU_INT08U divlo; CPU_INT08U divhi; CPU_INT32U pclk_freq; CPU_INT32U pinsel; #if (SER_COMM_SEL == SER_UART_0) pclk_freq = BSP_CPU_PclkFreq(PCLK_UART0); /* Get the CPU clock frequency */ divisor = (CPU_INT16U)(((2 * pclk_freq / 16 / ) + 1) / 2); divlo = divisor & 0x00FF; /* Split divisor into L and H bytes */ divhi = (CPU_INT08U)(divisor >> 8) & 0x00FF; pinsel = PINSEL0; /* Configure P0.2 & P0.3 for UART0 */ pinsel &= 0xFFFFFF0F; pinsel |= 0x ; PINSEL0 = pinsel; U0LCR = DEF_BIT_07; /* Set divisor access bit */ U0DLL = divlo; /* Load divisor */ U0DLM = divhi; U0LCR = DEF_BIT_00 | DEF_BIT_01; /* 8 Bits, 1 Stop, No Parity */ U0IER = 0x00; /* Disable both Rx and Tx interrupts */ U0FCR = DEF_BIT_00 | DEF_BIT_01 | DEF_BIT_02; /* Enable FIFO, flush Rx & Tx */ #endif

TSC Americas – IRD Platform – RS-232 Interface 16 IRD RS-232 Interface Software UART1 Initialization Code #if (SER_COMM_SEL == SER_UART_1) pclk_freq = BSP_CPU_PclkFreq(PCLK_UART1); /* Compute divisor for desired baud rate */ /* Get the CPU clock frequency. */ divisor = (CPU_INT16U)(((2 * pclk_freq / 16 / ) + 1) / 2); divlo = divisor & 0x00FF; /* Split divisor into L and H bytes */ divhi = (CPU_INT08U)(divisor >> 8) & 0x00FF; pinsel = PINSEL7; /* Configure P3.16 & P3.17 for UART1 */ pinsel &= 0xFFFFFFF0; pinsel |= 0x F; PINSEL7 = pinsel; U1LCR = DEF_BIT_07; /* Set divisor access bit */ U1DLL = divlo; /* Load divisor */ U1DLM = divhi; U1LCR = DEF_BIT_00 | DEF_BIT_01; /* 8 Bits, 1 Stop, No Parity */ U1IER = 0x00; /* Disable both Rx and Tx interrupts */ U1FCR = DEF_BIT_00 | DEF_BIT_01 | DEF_BIT_02; /* Enable FIFO, flush Rx & Tx */ #endif }

TSC Americas – IRD Platform – RS-232 Interface 17 IRD RS-232 Interface Software UART Write Byte and Write String Functions Code void Ser_WrByte (CPU_CHAR tx_byte) { #if (SER_COMM_SEL == SER_UART_0) while ((U0LSR & DEF_BIT_05) == 0) { ; } U0THR = tx_byte; #endif #if (SER_COMM_SEL == SER_UART_1) while ((U1LSR & DEF_BIT_05) == 0) { ; } U1THR = tx_byte; #endif } void Ser_WrStr (CPU_CHAR *tx_str) { while ((*tx_str) != 0) { Ser_WrByte(*tx_str++); }

TSC Americas – IRD Platform – RS-232 Interface 18 IRD RS-232 Interface Software UART Read Byte Function Code CPU_INT08U Ser_RdByte (void) { CPU_INT08U rx_byte; #if (SER_COMM_SEL == SER_UART_0) while ((U0LSR & DEF_BIT_00) == 0) { OSTimeDly(1); } rx_byte = (CPU_INT08U)(U0RBR); /* Remove the data from the holding register*/ return (rx_byte); #endif #if (SER_COMM_SEL == SER_UART_1) while ((U1LSR & DEF_BIT_00) == 0) { OSTimeDly(1); } rx_byte = (CPU_INT08U)(U1RBR); /* Remove the data from the holding register */ return (rx_byte); #endif }

TSC Americas – IRD Platform – RS-232 Interface 19 IRD RS-232 Interface Software UART Read String Function Code void Ser_RdStr (CPU_CHAR *rx_str, CPU_INT32U len) { CPU_CHAR input; CPU_CHAR input_ix; input_ix = 0; rx_str[0] = 0; while (1) { input = Ser_RdByte(); if ((input == '\r') || (input == '\n')) { Ser_WrByte('\n'); rx_str[input_ix] = 0; return; } If (input == '\b') { if (input_ix > 0) { Ser_WrStr((CPU_CHAR *)"\b \b"); input_ix--; rx_str[input_ix] = 0; } if (Str_IsPrint(input)) { Ser_WrByte(input); rx_str[input_ix] = input; input_ix++; if (input_ix >= len) { input_ix = len; }

TSC Americas – IRD Platform – RS-232 Interface 20 printf IRD RS-232 Interface Software printf Function Code void Ser_Printf (CPU_CHAR *format,...) { static CPU_CHAR buffer[80 + 1]; va_list vArgs; va_start(vArgs, format); vsprintf((char *)buffer, (char const *)format, vArgs); va_end(vArgs); Ser_WrStr((CPU_CHAR*) buffer); }

TSC Americas – IRD Platform – RS-232 Interface 21 LPC2000 Baud Rate Calculator Exercise Invoking the Program Download and run the file: – lpc2000.uart.baudrate.calculator.xls You should see a window similar to the one shown at the right This shows the suggested register values and relative errors for the standard UART and the enhanced UART (with the fractional baud rate generator)

TSC Americas – IRD Platform – RS-232 Interface 22 LPC2000 Baud Rate Calculator Exercise Example 1 Try entering some different values for UART CLK, for example, use 16Mhz –Notice that the results for a standard UART shows a high error rate of 3.55% –The enhanced UART with the fractional baud rate generator only has an error of 0.16%

TSC Americas – IRD Platform – RS-232 Interface 23 LPC2000 Baud Rate Calculator Exercise Example 2 Enter MHz for UART CLK –This is a standard baud rate multiple, so the error is 0%, even for the standard UART –However, this also shows that if you didn’t have the enhanced UART, you may need to compromise performance to get accurate baud rates

TSC Americas – IRD Platform – RS-232 Interface 24 IRD RS-232 Communications Exercise Set up Connect an RS-232 cable from your PC to the IRD board UART0 connector Make sure ISP jumpers JP8 and JP10 are NOT connected. Start a terminal program (i.e. HyperTerminal or TeraTerm) –Set it up for 115,200 baud, 8, N,1, and no flow control Reset the board and see if you get a command prompt ‘ > ‘ on the terminal program display Try issuing some of the shell commands listed on the next slide. –Typing “Sh_help” will also give you a list of the commands

TSC Americas – IRD Platform – RS-232 Interface 25 IRD RS-232 Communications Exercise Shell Command Example CommandExplanation Sh_helpList the supported commands. FS_lsList information about files in the current directory FS_cd [dir]Change the current directory to [dir] FS_pwdPrint the current working directory FS_cpCopy [source] to [dest] FS_mvRename [source] to [dest] or move [source] to [dir] FS_rmRemove [file] FS_rmdir [dir]Remove [dir], if it is empty FS_mkdir [dir]Create [dir], if it does not already exist FS_cat [file]Concatenate [file] contents to standard output FS_od [format] [file]Dump [file] to standard output in specified format. FS_volList information about volumes

TSC Americas – IRD Platform – RS-232 Interface 26