Home

Serial Tests

Info & Guidelines

Resources

UART Terminal Echo Test

Overview:

 - Once you've built the circuit, you'll need to test it, of course. The difference this time is that you'll be testing it "off board". A terminal emulation program needs to be installed, configured, and run on your PC (any computer). A USB cabled connection will be needed between the PC and your breadboard Z80 system where you will have attached a USB-to-Serial adaptor and installed its drivers

 

Parts:

 - A terminal emulation program. Tera Term is simple and effective for our needs and is at version 4.99

 - An FTDI USB to TTL Serial adaptor or FTDI Basic Breakout module. The board may be using the FT232RL chip or the less expensive CH340 chip. Either way, you're going to need drivers for the board for your PC's operating system. I have tested both of the chip driver links and they work

 - A mini USB or micro USB cable to connect your PC to the adaptor/module.

 - Before you order either USB-to-Serial adaptor, keep in mind that some are 5v, some are 3.3v, and some use a jumper to select between the two voltages. It's best to choose the 5v setting before you do anything else, otherwise, it could get fried

NOTE: The 16550D UART Schematic has the oscillator pins mislabeled: GND should be 4 and VCC should be 8.

 

USB to Serial Installation Guide

 - Here's are links to a circuit hookup guide and how to install the FTDI Drivers

 

How do I test my circuit?

 - Once you have burned the RS232-Terminal-Echo-Test.hex file onto a ROM and installed it into your Z80 system, wire the USB-to-Serial adaptor to the 16550D UART using the adjacent schematic, connect the USB cable, start up Tera Term and configure it for 1200bps; it's default is 9600bps. Now turn on the power to the Z80 breadboard. If there is something you need to change, disconnect the cable to the Serial adaptor first, then power off your Z80 system. If you don't follow this guideline, the Serial adaptor will attempt to power the entire breadboard with only 500mA and you may cook something. If you have one of those handy little voltage meters like is shown in the test videos, they'll indicate to you the brownout situation as there may be only 4v available to all of the devices. To repeat, the USB is powered down first and powered up last

 - Almost forgot, you'll need to select a port for the USB-to-serial adaptor. If you right-click on Computer on your PC's desktop and choose Manage, you can open the Device Manager and navigate to Ports where you can see the new USB Serial Port that may not have been there prior to your installing the USB-to-serial adaptor. The adjacent video will show you how

 - Okay, back to the testing. Any character you type on your keyboard should be echoed back to your screen. Local Echo is an option that is disabled by default on Tera Term

 - To exercise the system a little more, navigate to File|Send File|TeraTerm.INI. You will know right away if there is an issue with data integrity as your screen fills up with alphanumerics. The video below will show you how

 

The assembly code executes as follows:

Assembly file, RS232-Terminal-Echo-Test.asm, works as follows:

 - Initialize the UART

 --- OUT (LCR), 80h   ; Enables the device latch buffers to set the speed

 --- OUT (DLL), 60h   ; Sets the speed to 1200bps in the DL LSB

 --- OUT (DLM),00h   ; Sets the speed in the DL MSB. Total value of DL MSB and LSB is 0x0060

 --- OUT (LCR), 03h   ; Sets the byte framing to 8N1

 - Get a character from the UART's receive buffer

 --- IN (LSR bit 0)       ; "Has a byte been assembled from bits and is it sitting in the receive buffer?"

 --- IN (RBR)              ; Move the assembled byte in the RBR to the UART

 - Send a character to the UART's send buffer

 --- IN (LSR bit 5)       ; "Is there a byte ready to send in the THRE?"

 --- OUT (THRE)        ; Move the byte in the UART to the THRE to be sent as bits

 

How do I get this program onto my EEPROM?

 - The RS232-Terminal-Echo-Test.zip file contains the .asm file, a .lst file showing the machine code and assembly language, an .obj file that contains just the machine code, and a .hex file. The hex file is in Intel format which is used by most "burners".

 - Up until now we have been limping along using a file I built for you so you could load it into your Arduino-based EEPROM burner. The files are now getting much bigger and taking too long to build. It's time to consider buying a real EEPROM burner. Here's one that I have been using for several months. It's easy to configure, easy to setup and use each time, and very reliable. It's a TL866 II Plus. Don't get the plain TL866 if you can afford the TL866 II Plus. I bought mine on eBay for $54.14us with free shipping, and it took 2 weeks to arrive from Shanghai CN.

 

Eagle CAD: Serial FTDI RS232 Schematic

 

 

Video: UART Terminal Echo Test

Clicking the thumbnail gif above will provide an HD video (1.3MB, .mp4 format)

 

 

Oscilloscope: UART_CS signal

 

 

 

Z80 Assembly Language Programming

Visit Z80 Info X to learn how the Assembly code works for this circuit.

Also visit Z80 Info XI to learn how the Assembly code works for this circuit

 

UART Terminal String and Echo Test

Overview:

This test is a continuation of sorts of the one above. We have added a routine called START to display a string, and another called ECHO to echo every user key press of a displayable character.

 

Prep:

Configure your Tera Term VT terminal emulation software for the correct com port and speed of 9600bps 8N1. Under Setup|Save Setup, accept the default configuration file.

After you program the EEPROM with the RS232_String_Echo program and start up your Z80, plug in the USB cable and then fire up Tera Term. You'll need to press the Z80 reset button to synchronize the Z80 system/USB/terminal.

 

Troubleshooting:

If nothing is happening on your PC terminal after you press the Z80 Reset button and you have configured it for the correct COM port, speed, byte formatting (8N1), etc., then attach your o'scope to the UART_CS signal. Nothing?  Work backwards from there to figure what's missing.

 

EEPROM Program:

RS232_String_Echo.asm can be copied into the folder containing TASM32 and it can be assembled using the batch file, Assemble.bat. From there you can burn the EEPROM with the .hex file it created.

Video: Serial Test - String & Echo Display

Clicking the thumbnail gif above will provide an HD video (10.1MB, .mp4 format)

 

TOP

                                                                                                                                                                                                                                                                                                                        Tags: UART, 16C550

Home