LPC812 MAX Experiment: UART
If you're planning on running the treasures of the past you'll find here on real old Macintosh hardware from the 90's, you sir/madame, deserve to win an Internet! For others, there's SheepShaver, a PowerPC emulator capable of running Mac OS 9.0.4 down to Mac OS 7.5.2 and there's Basilisk II, a 68k emulator, capable of running Mac OS (8.1 to 7.0). Easily check which versions of mac OS, iOS, iPadOS, or watchOS are compatible with your Mac model or iDevice. Guide includes OS X 10.8.x to macOS 11.0.x. IBook is a line of laptop computers designed, manufactured, and sold by Apple Computer, Inc. From 1999 to 2006. The line targeted entry-level, consumer and education markets, with lower specifications and prices than the PowerBook, Apple's higher-end line of laptop computers. Apr 26, 2021 If your Mac is using an earlier version of any Mac operating system, you should install the latest Apple software updates, which can include important security updates and updates for the apps that are installed by macOS, such as Safari, Books, Messages, Mail, Music, Calendar, and Photos.
So far the microcontroller has had limited possibilities to communicate with the user. Technically it would have been possible to communicate information via an LED or a buzzer but it is not a very user friendly method and it would take time to communicate longer messages.
The mbed Microcontroller can communicate with a host PC through a 'USB Virtual Serial Port' over the same USB cable that is used for programming. In this lab you will experiment with that serial port.
Information
Note that the mbed microcontroller is not aware that it appears as a virtual serial port on the Host PC. That is handled by the onboard interface as shown in this image from the mbed-HDK page:
The LPC812 has three UART interfaces:
Peripheral Name | RX Pin | TX Pin | Arduino Shield Alias | EA Serial Header | Description |
---|---|---|---|---|---|
UART1 | PIO0_0 | PIO0_4 | D0 / D1 | Pin 8 / 7 | Used for communication |
UART2 | PIO0_1 / USBRX | PIO0_6 / USBTX | N/A | N/A | USB Virtual Serial Port |
UART3 | PIO0_10 | PIO0_11 | SDA / SCL | Pin 10 / 9 | Pins shared with I2C |
In most cases you will only use UART2 and only for printing. UART1 can be use for communication with external peripherals. UART3 is rarely used as it shares pins with the I2C bus and can only be used if the I2C bus is unused.
Background
In this experiment you will learn how to work with the Universal Asynchronous Receiver/Transmitter, or UART for short. The term asynchronous refers to the fact that no explicit clock signal is transmitted. The transmitter and receiver must agree beforehand on the bit rate, i.e., how long time a transmitted bit shall take. The idle state (no transmission) is a high signal. Transmission begins with a start bit, which is low. The negative edge is detected by the receiver and 1.5 bit periods after this, bit sampling begins. Eight data bits are sampled. The least significant bit (LSB) is typically transmitted first. An optional parity bit is then transmitted (for error checking of the data bits). Often this bit is omitted if the transmission channel is assumed to be noise free or if there are error checking higher up in the protocol layers. The transmission is ended by a stop bit. Typically one bit, but 1.5 and 2 bits are sometimes also used. Most common for inter-board communication is 8N1, meaning 8 data bits, no parity and one stop bit.
On a side note, there are methods to determine the bit rate of a received signal but that is out of scope for this experiment.
An UART channel consists of two signals (besides ground):
- TXD: transmit data, direction from transmitter to receiver. This is an output.
- RXD: receive data, direction from transmitter to receiver. This is an input.
TXD and RXD are crossed between transmitter and receiver, i.e., TXD is connected to RXD and vice versa. For more information about asynchronous serial communication, see http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter and http://en.wikipedia.org/wiki/Asynchronous_serial_communication.
Note and understand the difference between the signaling method (asynchronous serial communication) and standards of voltage signaling. The signal drawn in the image above illustrates the signal to/from the UART peripheral inside the LPC800. It is a 3.3V logic signal. This is common for communication between units on the same board, or closely mounted boards. RS232 is a common signaling standard with large voltage swings (+- 3-15V) that is used between units that are physically apart. RS422 and RS485 are other commonly used signaling standards. https://truekfil495.weebly.com/mark-keathley-fine-art-puzzles-mac-os.html.
Communication is normally point-to-point, meaning that a transmitter sends data to one receiver. There are signaling standards that also supports network topologies (for example RS422 and RS485). Higher protocol layers must then be involved in implementing addressing schemes between the nodes.
Hardware
Amd mobility radeon hd 5000 series driver windows 10. In these labs you will only need the LPC812 MAX board but it must be modified to allow you to usethe mbed interface's Virtual COM port.
Hardware Modification Needed
If you want to use the mbed interface Virtual COM port you need to modify your LPC812 MAX board. The instructions canbe found in the mbed-NXP-LPC800-MAX-Getting-Started.
Software
Your mbed Microcontroller can appear on your computer as a serial port. On Mac and Linux, this will happen by default. For Windows, you need to install a driver:
Foot-to-ball N+1 Mac Os Update
Windows
See Windows-serial-configuration for full details about setting up Windows for serial communication with your mbed Microcontroller
On the PC side, a terminal application is needed. A terminal application connects to a COM port and displays everything received and also allows sending data from the application (via keyboard and sending a file). These are examples of a few good terminal applications:
- TeraTerm (which is recommended), http://sourceforge.jp/projects/ttssh2/files
- PuTTY, http:///www.chiark.greenend.org.uk/~sgtatham/putty/
- Terminal by Bray, http://sites.google.com/site/braypp/terminal
- RealTerm, http://sourceforge.net/projects/realterm/files/
Download and install the selected terminal application. The next step is to configure the application. Typical configuration settings are selecting COM port, setting bit rate (for example 9600 bps), set if parity is used and number of stop bits. Flow control is another setting that is common. Select None for this setting. Other settings require either additional hardware or software support.
For TeraTerm, select New Connection in the File menu. Select the COM port that appears when the FTDI UART-to-USB cable is connected to the PC. Click OK. The screenshot below illustrates the dialog window for setting up a new serial connection.
N1 Vesti
To set the bit rate and other relevant settings for the serial channel, go to Setup menu and select Serial Port. A dialog, like illustrated in the screenshot below, opens. Make sure Flow control is set to none.
There are many different settings for how the terminal program shall behave (i.e., interpret received characters). Some adjustments might be needed, for example when to start displaying received characters on a new line. Under menu Setup, sub-menu Terminal setup it is possible to control these things. The screenshot below illustrates the settings possible for when a new-line shall be performed on received characters. A common setting is LF, but it also depends on which character the LPC800 application outputs.
Information
Some terminal programs (e.g. TeraTerm) list the available serial ports by name. However, if you do need to know the identity of the serial port so that you can attach a terminal or an application to it:
- Windows - Look under the 'Ports' section in 'Device Manager' ('Start -> Control Panel -> System -> Hardware -> Device Manager'). The name will be 'mbed Serial Port (COMx)', where 'x' is the number of the COM port allocated.
- Mac OS X - Use the command ls /dev/tty.usbmodem*
- Linux - Use the command ls /dev/ttyACM*
1) printf
Communication over the USB Serial port simply uses the standard Serial Interface, specifying the internal (USBTX, USBRX) pins to connect to the Serial Port routed over USB.
The Serial Interface defaults to a 9600 baud standard serial connection (8 bits, 1 stop bit, no parity), so your host program should be set to the same settings. If you want to communicate at a different standard baud rate, ensure you modify the settings of both the Serial Interface and the Host PC application!
The program below uses the Serial interface available in the mbed library.
Public Member Functions | |
Serial (PinName tx, PinName rx, const char *name=NULL) | |
Create a Serial port, connected to the specified transmit and receive pins. | |
void | baud (int baudrate) |
Set the baud rate of the serial port. | |
void | format (int bits=8, Parity parity=SerialBase::None, int stop_bits=1) |
Set the transmission format used by the serial port. | |
int | readable () |
Determine if there is a character available to read. | |
int | writeable () |
Determine if there is space available to write a character. | |
void | attach (void(*fptr)(void), IrqType type=RxIrq) |
Attach a function to call whenever a serial interrupt is generated. | |
template | |
void | attach (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq) |
Attach a member function to call whenever a serial interrupt is generated. | |
void | send_break () |
Generate a break condition on the serial line. |
Use the following program to verify that everything works. You should see the 'Hello World!' message in your terminal program on the Host PC.
Troubleshoot
If you modify your program and download it on the microcontroller you might need to disconnect and connect the terminal program on the Host PC to see the printouts from your modified program.
Create a program that determines the Endianness of the microcontroller and prints the result. Assume we have a 32-bit number: 0x0AC0FFEE in hexadecimal notation. The table below illustrates how the bytes are stored differently between a big and little Endian system.
Memory address | n | n+1 | n+2 | n+3 |
---|---|---|---|---|
Big-endian | 0x0A | 0xC0 | 0xFF | 0xEE |
Little-endian | 0xEE | 0xFF | 0xC0 | 0x0A |
Now think of a solution how to test this.
Tip: Create an unsigned int-pointer and an unsigned char-pointer. Let these pointers point to the same unsigned int-variable. Write a value in the unsigned int-variable with the unsigned int-pointer. Then read out the four parts via the unsigned char-pointer.
What Endian does the LPC812 have (little or big endian)?
The printf() function works like normal. It is possible to output strings and general expressions. Verify that this works.
2) Printing events
In this experiment you shall create a program that writes in the console every time a push-button is pressed. For simplicity, use the breadboard setup in the Digital Input Experiment.
3) Reading from the Console
In this experiment we will learn how the microcontroller can read input from the terminal program on the Host PC. The Serial class supplies functions to read and write one character (getc and putc) at a time. The calls are blocking, meaning that the microcontroller will stay in the library function call until the user (on the Host PC side) has entered the characters and hit the enter key.
Test the code below.
Run the program and enter five characters and then hit enter. What happens?
The reason for this is that there is a queue on the Host PC side. Each time getc() is called on the microcontroller side, a character is removed from the queue.
As an extra experiment, create a program that reads input from the console and converts it to a number. Check that only digits are entered and that the final number is within the range of a 32-bit number.
4) Performance test
In this experiment we will investigate the performance of the printing functionality. The default speed for the Serial class is 9600 baud which is enough for printing startup messages and warnings but when printing large amounts of data it becomes a limiting factor. The program below uses the Timer class from the mbed library to measure how much time passes when printing.
2) Printing events
In this experiment you shall create a program that writes in the console every time a push-button is pressed. For simplicity, use the breadboard setup in the Digital Input Experiment.
3) Reading from the Console
In this experiment we will learn how the microcontroller can read input from the terminal program on the Host PC. The Serial class supplies functions to read and write one character (getc and putc) at a time. The calls are blocking, meaning that the microcontroller will stay in the library function call until the user (on the Host PC side) has entered the characters and hit the enter key.
Test the code below.
Run the program and enter five characters and then hit enter. What happens?
The reason for this is that there is a queue on the Host PC side. Each time getc() is called on the microcontroller side, a character is removed from the queue.
As an extra experiment, create a program that reads input from the console and converts it to a number. Check that only digits are entered and that the final number is within the range of a 32-bit number.
4) Performance test
In this experiment we will investigate the performance of the printing functionality. The default speed for the Serial class is 9600 baud which is enough for printing startup messages and warnings but when printing large amounts of data it becomes a limiting factor. The program below uses the Timer class from the mbed library to measure how much time passes when printing.
Public Member Functions | |
void | start () |
Start the timer. | |
void | stop () |
Stop the timer. | |
void | reset () |
Reset the timer to 0. | |
float | read () |
Get the time passed in seconds. | |
int | read_ms () |
Get the time passed in mili-seconds. | |
int | read_us () |
Get the time passed in micro-seconds. |
Code romantic (itch) mac os. Complete the program below and then run it to see the limitation of the 9600 baud default setting.
Now use the baud function in the Serial class to set a higher baud rate, for example 115200, and run the program again. Don't forget to change the baud rate in the terminal program on the Host PC as well.
Solution(s)
lpc812_exp_solution_uart
Solutions for the UART experiments for LPC812 MAX
Last commit 22 Nov 2013 by
Please log in to post comments.
Is your Mac up to date with the latest version of the Mac operating system? Is it using the version required by a product that you want to use with your Mac? Which versions are earlier (older) or later (newer, more recent)? To find out, learn which version is installed now.
If your macOS isn't up to date, you may be able to update to a later version.
Which macOS version is installed?
From the Apple menu in the corner of your screen, choose About This Mac. You should see the macOS name, such as macOS Big Sur, followed by its version number. If you need to know the build number as well, click the version number to see it.
Which macOS version is the latest?
These are all Mac operating systems, starting with the most recent. When a major new macOS is released, it gets a new name, such as macOS Big Sur. As updates that change the macOS version number become available, this article is updated to show the latest version of that macOS.
Foot-to-ball N 1 Mac Os X
If your Mac is using an earlier version of any Mac operating system, you should install the latest Apple software updates, which can include important security updates and updates for the apps that are installed by macOS, such as Safari, Books, Messages, Mail, Music, Calendar, and Photos.
Foot-to-ball N 1 Mac Os Download
macOS | Latest version |
---|---|
macOS Big Sur | 11.3 |
macOS Catalina | 10.15.7 |
macOS Mojave | 10.14.6 |
macOS High Sierra | 10.13.6 |
macOS Sierra | 10.12.6 |
OS X El Capitan | 10.11.6 |
OS X Yosemite | 10.10.5 |
OS X Mavericks | 10.9.5 |
OS X Mountain Lion | 10.8.5 |
OS X Lion | 10.7.5 |
Mac OS X Snow Leopard | 10.6.8 |
Mac OS X Leopard | 10.5.8 |
Mac OS X Tiger | 10.4.11 |
Mac OS X Panther | 10.3.9 |
Mac OS X Jaguar | 10.2.8 |
Mac OS X Puma | 10.1.5 |
Mac OS X Cheetah | 10.0.4 |