EV51WZ1 Single sided evaluation board with download capability for 8051, 8052 and related microprocessors (c) 08.1994 by W.M. Zabolotny WZAB@ipe.pw.edu.pl Many thanks to my wife Anna, who helped me to prepare this documentation and to Wojciech Zaworski (WZAWOR@ipe.pw.edu.pl), who contributed to building and testing of EV51WZ1. LICENSE TERMS ------------------- EV51WZ1 is published as a freeware with no license fee required. The whole archive can be freely copied and distributed. The BINMIX package (containing BINMIX.EXE and BINMIX.TXT files) can be also distributed separately. You can use all published here materials for development of your own devices. Particularly you can modify all hardware solutions and all software with sources provided. If your software or device is based on EV51WZ1, please mention it in its documentation. WARRANTY DISCLAIMER THE EV51WZ1 IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTIES EITHER EXPRESSED OR IMPLIED CONSIDERING IT'S QUALITY OR EVEN CORRECTNESS. IN NO EVENT SHALL THE AUTHOR OF THIS PACKAGE BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY BUGS OR ERRORS IN BOTH SOFTWARE AND HARDWARE PUBLISHED IN THIS PACKAGE. Me, Wojciech Zabolotny, the author of EV51WZ1 and this documentation, have tested both hardware and software working in SIMPLE MODE with a 83C528 microprocessor produced by Philips and with a standard 8051 produced by Intel, using 62C256 RAM (32 KB) and 2764 EPROM (8K). However there is a small probability that during preparation of this archive occurred some errors damaging PCB layout or other components of the package. The PCB has been designed in such way, that it is necessary to cut of some tracks to enable some configurations. Therefore please read completely all documentation and be very careful during wiring and assembling the board. If you have any questions or comment, please mail them to me. Particularly please report to me if you find any errors in hardware or software contained in this archive, to help me to remove them from next release. M.Sc. Wojciech M. Zabolotny E-Mail: WZAB@ipe.pw.edu.pl Mail: Warsaw University of Technology Institute of Electronics Fundamentals Nowowiejska 15/19 00-665 Warsaw, POLAND 1 CONTENTS ----------- LICENSE TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 WARRANTY DISCLAIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 FEATURES OF EV51WZ1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 ARCHIVE CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 WHY TO USE EV51WZ1? . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 HOW TO BUILD MY OWN EV51WZ1? . . . . . . . . . . . . . . . . . . . . . . 4 PREPARING PRINTED BOARD . . . . . . . . . . . . . . . . . . . . . . 4 ASSEMBLING PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 PREPARING EPROM . . . . . . . . . . . . . . . . . . . . . . . . . . 4 PREPARING GAL . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 PREPARING COMMUNICATION SOFTWARE . . . . . . . . . . . . . . . . . . 5 HOW TO USE EV51WZ1? . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 HOW TO CUSTOMIZE EV51WZ1 FOR DIFFERENT HARDWARE CONFIGURATIONS? . . . . . 6 PROGRAM DOWNLOADING . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 MEMORY MAPPING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . 8 EXTENDED MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 MIXING OF ADDRESS AND DATA LINES . . . . . . . . . . . . . . . . . . . . 11 FREQUENTLY ASKED QUESTIONS . . . . . . . . . . . . . . . . . . . . . . . 12 FEATURES OF EV51WZ1 --------------------------- EV51WZ1 is an evaluation board for 8051, 8052 and related microprocessors. Features of EV51WZ1: ù Capability to download contents of code memory through serial interface ù Up to 32 KB of RAM and up to 32 KB of EPROM ù 7 or 6 lines of P1 port available for user ù 4 lines of P3 port available for user ù Two modes of work: ù SIMPLE MODE with an additional 8-bit parallel input and 8-bit parallel output ù EXTENDED MODE with external data (8-bit) and address (8-bit) busses ARCHIVE CONTENTS ----------------------- EV51WZ1.TXT - This file EV51WZ1.PCB - Easytrax file, contains layout of printed board CIRCUIT.PCB - Easytrax file, contains schematic diagram of EV51WZ1 2 EV51.CPP - C-source of communication software for host computer RS232.ASM - assembler RS232 routines for communication software EV51MAKE.BAT - batch file for compilation and linking of EV51.EXE EV51.EXE - Executable file for host computer EV51BOOT.ASM - Loader software (in 8051 assembly language) for EV51WZ1 EV51BOOT.MXD - Binary file with compiled and "mixed" loader, ready to be placed in EV51WZ1's EPROM BINMIX.EXE - Utility for conversion binary EPROM data for microprocessor systems with "mixed" address and/or data lines BINMIX.TXT - BINMIX's description EV51WZ1.MIX - BINMIX's configuration file for EV51WZ1 SAMPLE.ASM - Sample application for EV51WZ1 SAMPLE.HEX - HEX-file of sample application (ready for downloading) WHY TO USE EV51WZ1? ------------------------- The easiest and most convenient way to develop and debug a single chip microcontroller application is to use an in-circuit emulator. In this case you have all microcontroller's pins free for your application. The only disadvantage of such solution is the high price of emulator. If you have no emulator, and you don't want to sacrifice microcontroller's ports for driving data and address busses, the best solution would be to use an microcontroller with EPROM socket on it's case, working with EPROM simulator. Such equipment lets you change microcontroller's software quickly and easily, enabling testing of hardware and developing of software. Unfortunately such versions of microcontroller cost much more than normal (in Poland: normal second hand 8051 - 1$, while 8051 with EPROM socket ~ 70$), additionally also EPROM simulator is relatively expensive. EV51WZ1 due to its downloading capability allows you to change microcontroller's software as easily as in the cases of in-circuit emulator or EPROM simulator. The price you have to pay for it is a necessity to use microcontroller in configuration with external program memory, so ports P0 and P2 are not available for any other purposes. If you can accept it - EV51WZ1 can be an ideal solution for you (sometimes, for example when you have to handle big amount of data, you need an external memory anyway). Having finished development of your device, you can replace original EV51WZ1's EPROM with another one with final version of your software. However my suggestion is that you should preserve downloading capability in your software - it will allow you, for example to download the diagnostic software or test new versions of program without a need to change device's EPROM. Releasing EV51WZ1 as a freeware I hope that it can help many people who need an inexpensive development tool for 8051 family microcontrollers. Because PCB layout is given as an Easytrax file - you can customize it in any way you want, for example you can treat it just as a microprocessor's module to be added to your printed board with other components of your device. I know that EV51WZ1 can be improved in many ways. I hope that some of these, who benefit from using it, will also contribute to its improvement. For example it would be very useful to add a simple monitor system to the EV51WZ1's EPROM allowing to trace execution of downloaded software, to set breakpoints, view and modify registers etc. 3 HOW TO BUILD MY OWN EV51WZ1? ---------------------------------- To get your own EV51WZ1 you have to perform following steps: 1) PREPARING PRINTED BOARD There is the complete layout of printed board in the file EV51WZ1.PCB. This file has been prepared using Protel's Easytrax freeware (you can obtain it from many ftp servers over the Internet). Please note, that EV51WZ1 uses a single sided PCB. There are some tracks on "3 Mid Layer" but they indicate only jumpers to be mounted when assembling PCB. The price to be paid for single sided PCB and low amount of jumpers is "mixing" of address and data lines. Please read section "MIXING OF ADDRESS AND DATA LINES" (page 11) for further details. 2) ASSEMBLING PCB Please print out "Overlay" and "3 Mid Layer" layers together, to get the guide for PCB assembling. I suggest you to mount sockets for all integrated circuits, especially for MMU and EPROM. If you use another EPROM than 27256 and another RAM than 62256, please read section "HOW TO CUSTOMIZE EV51WZ1 FOR DIFFERENT HARDWARE CONFIGURATIONS" (Page 6). Note that there is no place on the board for some important circuits, like RESET circuitry and RS232 level converter. Therefore you can customize these circuits in the way you want to. As power supply you have to provide single +5V voltage (Vcc), supply current in my device was ca. 100 mA, however it significantly depends on used microcontroller and memories. 3) PREPARING EPROM You can program the EPROM you want to use with binary data contained in the EV51WZ1.MXD file. However, if you want to introduce some changes, you have to compile your modified EV51BOOT.ASM source, convert it into binary file, and finally "mix" it using BINMIX.EXE with EV51WZ1.MIX configuration file. The last step is necessary, because address and data lines between processor and EPROM are swapped (for example line A7 of microprocessor is connected to line A0 of EPROM). Please read section "MIXING OF ADDRESS AND DATA LINES" (page 11) for further details. Suggested command line for mixing: binmix ev51wz1.mix ev51boot.bin ev51boot.mxd 4) PREPARING GAL To prepare GAL you have to use any GAL assembler and GAL programmer. This is GAL description for standard version of EV51WZ1: 4 GAL LAYOUT: Chip: GAL 16V8 +---------\ /---------+ | \ / | | ----- | uP_P4 | 1 20 | Vcc | | uP_WR | 2 19 | RAM_OE | | uP_P5 | 3 18 | RAM_WE | | uP_RD | 4 17 | ROM_OE | | uP_PSEN | 5 16 | | | uP_A15 | 6 15 | | | uP_ALE | 7 14 | U245_DIR | | | 8 13 | U573_CLK | | | 9 12 | U245_G | | GND | 10 11 | | | | | `---------------------------' LOGICAL EQUATIONS ( ! - negation, # - logical OR, & - logical AND) U245_DIR = 0; U573_CLK = (!uP_P4 & !uP_WR & uP_A15) # (uP_P4 & !uP_WR & !uP_A15 ); U245_G = !((!uP_P4 & !uP_RD & uP_A15) # (uP_P4 & !uP_RD & !uP_A15)); RAM_OE = !((uP_P4 & !uP_RD & uP_A15) # (!uP_P4 & !uP_RD & !uP_A15) # (!uP_P5 & !uP_PSEN & !uP_A15)); RAM_WE = !((uP_P4 & !uP_WR & uP_A15) # (!uP_P4 & !uP_WR & !uP_A15 )); ROM_OE = !((uP_P5 & !uP_PSEN) # (!uP_PSEN & uP_A15 )); 5) PREPARING COMMUNICATION SOFTWARE If you use an IBM-compatible computer, you can use the ready for use ev51.exe software. If you want to customize it, or if you have another computer and you have to modify this software - there are all sources provided (ev51.cpp and rs232.asm). Sources are generally prepared for Borland C++, and Borland Turbo Assembler, however there should be no problems with customizing them for different compilers. If you want or have to write your own communication software from the beginning, information in the part "PROGRAM DOWNLOADING" (Page 7) may be useful for you. 5 HOW TO USE EV51WZ1? ------------------------- After your EV51WZ1 is ready, you can connect it to any RS232 interface in your computer (the only requirement is that this RS232 interface can generate interrupts). Next run the communication software, giving three parameters in the command line: base address of RS232 interface (in hex), number of interrupt line used (in dec) and name of hex file to be downloaded to the EV51WZ1. (For example: ev51 3e8 9 sample.hex) After communication software starts, turn on (or reset, if it was already turned on) the EV51WZ1 - The "EV51WZ1 ... Ready" message should appear. Next press SPACE key and downloading begins. If everything is OK, series of dots appear on the screen to inform you that downloading is in progress. After downloading finishes, execution of downloaded program will start, and communication program will enter the terminal mode. Everything you type on the keyboard is sent to the EV51WZ1, and everything what EV51WZ1 is sending via serial interface is displayed on the screen. To exit communication software, press the '~' key. HOW TO CUSTOMIZE EV51WZ1 FOR DIFFERENT HARDWARE CONFIGURATIONS? ------------------------------------------------------------------ 1) IF YOU DON'T WANT TO USE ADDITIONAL PARALLEL INPUT/OUTPUT NEITHER EXTERNAL BUSSES DRIVERS: You may just not mount circuits U6 and U7. 2) IF YOU NEED 7 LINES OF PORT P1 You may not use P4 line for driving MMU chip (My software does not use MMU modes 3 and 4). Certainly in this case you have to modify GAL contents, or cut the track connecting 1st pin of MMU with pin P1.4 of 8051 and assure high logic level on the 1st pin of MMU by other means. (See part "MEMORY MAPPING MODES" on page 8 and "CONTENTS OF GAL WHEN P1.4 IS NOT USED FOR MEMORY SWITCHING" on page 8) 3) IF YOU WANT TO USE DIFFERENT EPROMs Generally EV51WZ1 has been designed to work with 27C256 EPROM, however you can use a different one: 2732 In this case you have to connect pin 24 of 2732 (pin 26 of socket, if you have mounted an 28 pin socket) to Vcc. To do this cut the track below pad X6 (to separate this pad from microprocessor's A13 line), and connect pad X6 with X7. Remember to insert EPROM so, that pins 1, 2 and 28, 27 of 28-pins socket remain free. 2764 and 27128 In this case you should connect pin 27 of EPROM to Vcc through a 3kê resistor to assure high logic level on this pin. To do this cut the track below X8 pad, and mount vertically a 3k resistor between pads X8 and X9. 4) IF YOU WANT TO USE DIFFERENT RAMs Generally EV51WZ1 has been designed to work with 62256 RAM, however there is possibility to customize it for another RAMs: 6 6116 If you want to use this chip, you have to connect pin 24 of 6116 (pin 26 of socket, if you have mounted an 28 pin socket) to Vcc. To do this cut the track below pad X3 (to separate this pad from microprocessor's A13 line), and connect pad X3 with X4. Remember to insert RAM so, that pins 1, 2 and 28, 27 of 28-pins socket remain free. Additionally, it is necessary to connect "Write Enable" signal to the pin 21 (23rd socket's pin) of 6116 instead of A11. Cut the track below X2 pad and connect RAM_WE pin of MMU (pin 18) to X2, instead of X5. 6264 To use this 8KB RAM you have to assure high level on pin 26 of 6264. To accomplish this cut the track below pad X3 (to separate this pad from microprocessor's A13 line), and mount an 3k resistor vertically between pads X3 and X4. PROGRAM DOWNLOADING ----------------------- EV51WZ1 accepts standard Intel-Hex files. Data from such a file should be sent record by record, however without terminating CR LF sequence. The transmission or protocol error message: '?' is sent to the host in the following cases: 1) If transmission error occurs 2) If an character not allowed in hex-record has been received 3) If wrong checksum has been received In cases 1 and 2, error message can be sent before the whole record has been received. After the whole record has been received, EV51WZ1 writes received data to the appropriate RAM location, and checks if data have been written correctly. In the case of error, the memory failure message: '#' is sent to the host. If data have been written correctly, EV51WZ1 sends acknowledgment containing four bytes: 1) '!' character 2) MSB of target address of downloaded data 3) LSB of target address of downloaded data 4) Received checksum If the end record has been received (length of data = 0, and fourth byte set to 1), target address is treated as start address of downloaded program. Memory is switched to mode 1 and execution starts from specified address. Note The MetaLink's cross assembler does not allow you to specify start address in the last record of the hex file, using the "end address" directive. Instead of that it always place "0" there, so remember that your downloaded program will start from zero position. (Unless you use another assembler). To obtain any other information concerning downloading, you can analyze communication software (especially EV51.CPP) and EV51WZ1's loader (EV51BOOT.ASM). You can also mail me your questions and doubts, helping me to improve this documentation. 7 MEMORY MAPPING MODES ------------------------- Mode pin pin Code address Data address space P1.5 P1.4 space 0000- 8000- 0000- 8000- 7fff ffff 7fff ffff 3 (Start H H EPROM EPROM I/O or RAM mode) External RAM 2 H L EPROM EPROM RAM I/O or External RAM 1 L H RAM EPROM I/O or RAM External RAM 0 L L RAM EPROM RAM I/O or External RAM Explanations: EPROM - EPROM placed on EV51WZ1E's board RAM - RAM placed on EV51WZ1E's board I/O or External RAM - in simple mode: additional parallel I/O, in expanded mode: I/O or RAM connected to external busses Please note, that in the modes 1 (selected after downloading has finished) and 2 the same memory is mapped into 0-7fff area of code space and area 8000h-0ffffh of data space. If you write some data to byte 8000h, it will overwrite code in byte 0000 of code space. If you do not plan to use modes 2 and 0, you can use pin P1.4 of 8051 for other purposes. In this case you have to modify GAL contents: CONTENTS OF GAL WHEN P1.4 IS NOT USED FOR MEMORY SWITCHING: U245_DIR = 0; U573_CLK = (!uP_WR & !uP_A15 ); U245_G = !(uP_P4 & !uP_RD & !uP_A15); RAM_OE = !((!uP_RD & uP_A15) # (!uP_P5 & !uP_PSEN & !uP_A15)); RAM_WE = !(!uP_WR & uP_A15); ROM_OE = !((uP_P5 & !uP_PSEN) # (!uP_PSEN & uP_A15 )); 8 If you do not want to modify GAL contents but you need P1.4 pin, you should cut the track connecting pin P1.4 with input uP_P4 of GAL, and provide high logical level on uP_P4 input by other means. EXTENDED MODE ------------------- As it was mentioned above, EV51WZ1 is capable to drive external 8-bit address bus and external 8-bit data bus. This feature allows you to connect many standard I/O chips like 8255 or 8253, A/D converters and others. External busses are driven by buffers placed on the board: U6 (74HCT573) and U7 (74HCT245). Of course you have to make also some changes in the board, and change the GAL contents: Version 1 1) Cut the track between IO_WR pad and 11th pin of U6. 2) Connect the 11th pin of U6 to the microprocessor's ALE line (there is a pad placed especially for this purpose). 3) Change the GAL, to the another one: CONTENTS OF GAL FOR EXTENDED MODE VERSION 1 GAL LAYOUT: Chip: GAL 16V8 +---------\ /---------+ | \ / | | ----- | uP_P4 | 1 20 | Vcc | | uP_WR | 2 19 | RAM_OE | | uP_P5 | 3 18 | RAM_WE | | uP_RD | 4 17 | ROM_OE | | uP_PSEN | 5 16 | | | uP_A15 | 6 15 | | | uP_ALE | 7 14 | U245_DIR (IO_RD) | | | 8 13 | IO_WR | | | 9 12 | U245_G (IO_CS) | | GND | 10 11 | | | | | `---------------------------' LOGICAL EQUATIONS ( ! - negation, # - logical OR, & - logical AND) U245_DIR = !((!uP_P4 & !uP_RD & uP_A15) # (uP_P4 & !uP_RD & !uP_A15)); 9 U245_G = !((!uP_P4 & uP_A15) # (uP_P4 & !uP_A15)); IO_WR = !((!uP_P4 & !uP_WR & uP_A15) # (uP_P4 & !uP_WR & !uP_A15)); RAM_OE = !((uP_P4 & !uP_RD & uP_A15) # (!uP_P4 & !uP_RD & !uP_A15) # (!uP_P5 & !uP_PSEN & !uP_A15)); RAM_WE = !((uP_P4 & !uP_WR & uP_A15) # (!uP_P4 & !uP_WR & !uP_A15 )); ROM_OE = !((uP_P5 & !uP_PSEN) # (!uP_PSEN & uP_A15 )); In this version signals IO_RD, and IO_CS (all active with low level) and signals driving buffer U7 (74HCT245) are the same. Certainly it's not the safest solution: For example if both these lines get shorted to the ground, U6 is still driving internal data bus, causing collisions. You can fix it using two unused GAL's outputs as external IO_CS and IO_RD signals: (version 2) Version 2 1) Cut the track between IO_WR pad and 11th pin of U6 2) Connect the 11th pin of U6 to the microprocessor's ALE line (there is a pad placed especially for this purpose). 3) Route IO_RD and IO_CS signals to the external connector, using isolated wires. 4) Change the GAL to the another one: CONTENTS OF GAL FOR EXTENDED MODE VERSION 2 10 GAL LAYOUT: Chip: GAL 16V8 +---------\ /---------+ | \ / | | ----- | uP_P4 | 1 20 | Vcc | | uP_WR | 2 19 | RAM_OE | | uP_P5 | 3 18 | RAM_WE | | uP_RD | 4 17 | ROM_OE | | uP_PSEN | 5 16 | IO_RD | | uP_A15 | 6 15 | IO_CS | | uP_ALE | 7 14 | U245_DIR | | | 8 13 | IO_WR | | | 9 12 | U245_G | | GND | 10 11 | | | | | `---------------------------' LOGICAL EQUATIONS ( ! - negation, # - logical OR, & - logical AND) U245_DIR = !((!uP_P4 & !uP_RD & uP_A15) # (uP_P4 & !uP_RD & !uP_A15)); IO_RD = !((!uP_P4 & !uP_RD & uP_A15) # (uP_P4 & !uP_RD & !uP_A15)); U245_G = !((!uP_P4 & uP_A15) # (uP_P4 & !uP_A15)); IO_CS = !((!uP_P4 & uP_A15) # (uP_P4 & !uP_A15)); IO_WR = !((!uP_P4 & !uP_WR & uP_A15) # (uP_P4 & !uP_WR & !uP_A15)); RAM_OE = !((uP_P4 & !uP_RD & uP_A15) # (!uP_P4 & !uP_RD & !uP_A15) # (!uP_P5 & !uP_PSEN & !uP_A15)); RAM_WE = !((uP_P4 & !uP_WR & uP_A15) # (!uP_P4 & !uP_WR & !uP_A15 )); ROM_OE = !((uP_P5 & !uP_PSEN) # (!uP_PSEN & uP_A15 )); MIXING OF ADDRESS AND DATA LINES --------------------------------------- EV51WZ1 has been designed to fit on the single sided PCB. To get the shortest connections and to minimize number of jumpers, it was necessary to "swap" address and data lines. 11 Address and data lines are connected in the following way: Address lines Data lines Microproc. Memory Microproc. Memory A0 A7 D0 D3 A1 A6 D1 D2 A2 A5 D2 D4 A3 A4 D3 D1 A4 A3 D4 D5 A5 A2 D5 D0 A6 A1 D6 D6 A7 A0 D7 D7 A8 A8 A9 A9 A10 A10 A11 A11 A12 A12 A13 A13 A14 A14 A15 A15 The only result of this line mixing is that you have to convert your binary data to be placed into the EPROM using an especially written BINMIX.EXE utility. This utility is part of this package however it can be used for many other microprocessor system with "mixed" data or address lines. You can find user manual of BINMIX.EXE in the file BINMIX.TXT found in this archive. EV51WZ1.MIX file contains configuration file allowing BINMIX to convert files for EV51WZ1. FREQUENTLY ASKED QUESTIONS ------------------------------- Q: Why in the "START" mode data memory is placed into 8000h-ffffh address space? 12 A: In some microprocessors (for example 83C528 produced by Philips) there is a built-in external memory,which occupies lower part (for example 0000h-0100h) of data address space. Q: Why P1.4 and P1.5 lines are used for memory modes switching? The usage of P1.6 and P1.7 lines would be more natural. A: In some microprocessors (for example 83C528 produced by Philips) P1.6 and P1.7 lines are used for I2C interface. If you are not planing to use this two lines for other purposes, you can change the board layout (and of course program.) Q: I don't see any source of negative voltage in RS232 level converter, does it really work? A: The TTL/RS232 level converter presented on CIRCUIT.PCB has been tested and used by me. I know, that according to RS232 standard the converter from TTL to RS232 shouldn't work, because the output voltage should fall below -3 V to be interpreted as "space". However all RS232 interfaces for IBM compatible computers I have checked worked good with such level converter. Of course you can use the better one (for example based on MAX232 chip). 13