UART Devices ECE 480: Design Team 3 Application Note By: Hoyoung Jung Date: 4/3/15 Abstract The integration and communication of electronic systems requires the receiving and transmitting of data. In order to create a seamless network between these systems, communication between all electronic devices must be coherent. Miscommunication can occur with improper connections in the wires or system settings. Brief explanations of various components of universal asynchronous receive and transmit (UART) devices and serial communication will be explained in the following information. Page 1
Table of Content Abstract 1 Table of Content 2 Key Words 3 Introduction 3 Connection 3 Microcontroller to PC 4 IDE vs. SSH 5 Conclusion 7 Resources 8 Page 2
Key Words: UART, RS-232, Secure Shell (SHH), ASCII, microcontroller, Debugging Interface, Integrated Development Environment (IDE) Introduction Much like communication amongst people, electronic systems interact in a similar manner. If one cannot understand the language or signs of another, than there will be confusion or misunderstanding. This is no different in communication between devices. If the receiving device cannot interpret the data being transferred or the data itself cannot be transferred, than the receiving device will be unsuccessful obtaining and utilizing the data. A standard serial communication system, known as the universal asynchronous receiving and transmitting controller, was developed to ensure that all electronic systems are capable of receiving and transmitting data. This asynchronous method is standardized more than the synchronous due the fact that the transmitter does not have to send a clock signal to the receiver, rather timing parameters are declared prior to the data transfer and signaling bits are implemented to synchronize the two. At the transmitting end, the UART takes bytes of data and transmits the individual bits in a sequential fashion. At the receiver, a separate UART re-assembles the bits into complete bytes. Start, parity, and stop bits denote where the data transmitted begins and ends. If these bits do not match up from the transmitter to the receiver, than one would have a Framing Error. This is typically due to the transmitter and receiver not running at the same speed. Baud is the measurement of transmission speed in asynchronous communication and, thus, the baud rates must be the same throughout the system. Data terminal equipment (DTE) and data circuitry-terminating equipment (DCE) was developed and standardized as a part of RS- 232, which defines the electrical characteristics and timing of signals and the physical size and pinout of connectors. Now, lets go through each of these steps to get familiarized with each component. Connection When it comes to UART devices, there are many different ways to make the connection between the transmitting and receiving devices. The RS-232 cables can vary in the number of pins, but 6 and 9 pin configurations are most common. Figure 1 RS-232 9 Pin Pinout Page 3
As the number of pins is not a set standard, adapters can be utilized to create a connection between devices. And as the electronic communication is becoming more sophisticated, other forms of cables can be utilized for data transfer as well, such as a universal serial bus (USB). However, these connections can be made manually as well through direct connections. But if this method is used, one must be careful and understand the functionality of each pin. The most important pins to remember are the receiving (RX) and transmission (TX) pins. Connections between these two pins are vital. The other pins can be dealt with in various fashions. But for the most efficient usage, a clear handshake must be made between the two connectors, meaning all connections between the pins are made. This can be depicted in Figure 2 below. Figure 2 Full Handshake Connection The receiver sends a clear-to-send signal to indicate to the transmitter that it is ready. The transmitter sends a request-to-send signal to the receiver to obtain permission to send the data. Data terminal ready and data set ready are ready to receive signals from the transmission or receiving end. Microcontroller to PC A microcontroller is a small computer on a single integrated circuit with a processing core, memory, and input/output peripherals. Many devices use microcontrollers as their primary unit. Initially, data transfer between the two devices can be complicated. But if the connections are made properly between the two devices, there are a few steps that must be made to ensure that the communication is functional. Check the data sheet of the microcontroller to ensure that there is sufficient power through the device. This power supply generates electrical impulses that convert 7-bit binary integers that are then translated into a standardized character-code scheme, known as American Standard Code for Information Interchange (ASCII). Also, be sure to check that the proper pins on the microcontroller have been set for inputting and or outputting this data. Page 4
Figure 3 MCU to PC Schematic Some devices come with built-in flash emulating tools (FET), which allow a device to temporarily replace flash memory for the purpose of debugging embedded software. But in the event that the device does not have a FET, a debugging interface must be obtained. For example, many Texas Instrument boards, such as the MSP430F5438 Experimental Board, do not come with a build in FET and therefore the MSP-430UIF Debugging Interface is required. IDE vs. SSH Figure 4 MSP-FET430UIF Debugging Interface An integrated development environment (IDE) is a software that provides programmers access to build code in a source code editor and a debugger to analyze and test the code for errors. A secure shell (SSH) consists of an encrypted tunnel that users may set to transfer unencrypted traffic over a network through an encrypted channel. Once the SSH tunnel has been established, the user can connect to the specified local port to access the network service. A common IDE for the MSP430 microcontrollers is the Code Composer Studio software. It uses C/C++ compiler and is comprised of many development and debugging tools. Setting pins on a microcontroller and programming various functions or applications can be done through this software. However, there are many other IDE applications that function with various microcontrollers, such as the Arduino microcontroller that has its own IDE software. Page 5
Computers typically come with a standard built-in SSH, like the Command Prompt for Windows or the Terminal for Macs. Other shells that could be used include, PuTTY and Tera Term. Once one decides on the shell to use, proper settings will allow users to communicate with the MCU and obtain the output data in the shell. Access the port settings to adjust the COM port of the shell to match the COM port the target device is connected to. The COM port of the target device can be checked by going to the Start!Control Panel!System!Device Manager!Ports (COM & LPT). Figure 5 Device Manager COM Ports Be sure to adjust the Baud Rates (bits/s) to the correct rate for all devices. This can be done when right-clicking on the device in the device manger menu. Baud rates for the RS-232 serial ports are listed as follows: 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, and 230400. Page 6
Figure 6 COM Port Baud Rate Selection Conclusion Taking the time to understand the interconnection of an electronic systems will provide users an in depth understanding of how the system functions. As there are various ways to make connections between devices, the understanding of the transmitting and receiving pins will allow users to grasp the general idea. Since the data transferring is reliant on these connections, proper and thorough connections must be initialized in order to optimize communication within the electronic system. Page 7
Resources http://www.argenox.com/library/msp430/msp430-uart-peripheral-chapter-8/ http://courses.cs.tamu.edu/cpsc483/rabi/xilinx/chap12/chap12.html http://www.farnell.com/datasheets/1696900.pdf https://www.freebsd.org/doc/en_us.iso8859-1/articles/serial-uart/index.html#uart http://www.lammertbies.nl/comm/cable/rs-232.html Page 8