ARM LPC2129 Mini Development Board – UART0 Interfacing
In ARM LPC2129, there are two UART modules named by UART0 and UART1. Considering UART0 communication, two port pins are used – P0.0(transmission), P0.1(reception).
This Mini Development Board features 4 different connections for on board UART0 communication, they are:
- USB via CP2102
- Serial RS232 via MAX232
- RMC connecter (GND,TXD0,RXD0,Vout) 3V3/5V level
- Zigbee compatible connector on top and bottom side
UART0 communication via USB/Serial port is selected using jumpers J7 and J9. Through RMC connecter,UART0 can be used in two voltage levels of 3V3/5V which can be selected using jumper J16. While using UART0 communication PROGRAMMER switch should in manual mode else communication is not possible.
Sample code to test both transmission & reception of UART0 is given below. Initially the string “Checking UART0″ to gets transmitted. Upon receiving a character, the same gets retransmitted.
Schematic:Sample code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
/******************************************************************************************************* * UART0 PROGRAM * ******************************************************************************************************** * HEADER DECLARATIONS * *******************************************************************************************************/ #include<lpc21xx.h> /******************************************************************************************************* * Function : Uart_Init * * Description : UART_0 initialization function * * Parameter : None *******************************************************************************************************/ void Uart_Init(void) { U0LCR=0X83; /* line control registor */ U0DLL=0XC3; /* baud rate registor */ U0DLM=0X00; /* baud rate registor */ U0LCR=0X03; /* line control registor */ } /****************************************************************************************************** * Function : Uart_Data * * Description : UART_0 data transmission function * * Parameter : data ******************************************************************************************************/ void Uart_Data(unsigned char data ) { U0THR = data; while((U0LSR & 0X20)!= 0X20); } /****************************************************************************************************** * Function : Uart_String * * Description : UART_0 group of data transmission function * * Parameter : dat ******************************************************************************************************/ void Uart_String(unsigned char *dat) { while(*dat!='\0') { Uart_Data(*dat); dat++; } } /******************************************************************************************************* * PORT INITIALIZATION FUNCTION * *******************************************************************************************************/ void Port_Initial(void) { PINSEL0 = 0x00000005; } /******************************************************************************************************* * CODE AREA * *******************************************************************************************************/ int main() { Port_Initial(); /* Function to initialize the ports */ Uart_Init(); /* Initialization of Uart0 */ Uart_String("Checking UART0"); while(1) { if((U0LSR&0X01)==0X01) { U0THR = U0RBR; while((U0LSR&0X20)!=0X20); } } } /*********************************************END******************************************************/ |
OUTPUT:
The following screenshots explain how to test the sample code.
Realterm (Download)
- Step 1:Open the Realterm
- Step 2: RealTerm opens as shown below
- Step 3: Go to ‘Port’ option, set correct baudrate (which is set as 9600 in the sample code) and give correct port number.
- Step 4: Click ‘Change’ (encircled in red) to apply the changes. Now check the status of Port. If it is closed, click ‘Open’ button (encircled in green) to open it.
- Step 5: The data transmitted from the board can be viewed as shown below.
- Step 6: To check reception, go to Send option, type the string in the space provided(encircled in green) and click Send ASCII button. The first “hello” in green colour is transmitted from PC & that in yellow colour is retransmitted by the controller
Topics related to ARM LPC2129 Mini Development Board:
- ARM LPC2129 Mini Development Board – Overview
- ARM LPC2129 Mini Development Board – LED Interfacing
- ARM LPC2129 Mini Development Board – LCD Interfacing
- ARM LPC2129 Mini Development Board – UART0 Interfacing
- ARM LPC2129 Mini Development Board – UART1 Interfacing
- ARM LPC2129 Mini Development Board – Switches Interfacing
- ARM LPC2129 Mini Development Board – BUZZER Interfacing
- ARM LPC2129 Mini Development Board – POT Interfacing (ADC)
- ARM LPC2129 Mini Development Board – Temperature Sensor Interfacing(ADC)
- ARM LPC2129 Mini Development Board – Interfacing Servo motor
- ARM LPC2129 Mini Development Board – CAN Interfacing
Resources
- Softwares
- Datasheets
How to buy?
- Click here to buy rhydoLABZ ARM LPC2138 Mini Development Board
- Click here to buy rhydoLABZ ARM LPC2148 Mini Development Board
- Click here to buy rhydoLABZ ARM LPC2129 Mini Development Board
Support
Please share your ideas with us,visit our forum for discussion