USB & GLCD expansion board for 8051SBC

Wichit Sirichote,

Simple expansion board for 8051SBC provides easy USB port and graphic LCD interface.
I am planing to design the x86 board for some of my application that needs more computing capability. One of the feature that I need to add to the x86 board is USB port. I found the ASIC that enables 8-bit MCU to interface USB easily from Future Technology Devices International: FTDI. The USB controller chip is FT245BM. Fortunately near my campus, the Astron Logic company sells the ready board for such USB chip with connector. So I bought it to learn how to interface with 8051SBC. Also I got one graphic LCD 128x64pixels. I thought why don't put them together and build the expansion board for testing with 8051SBC. This led me to provide details what I have done. However no real application with the 8051SBC has completed yet. Below was the sample hardware and some testing code only.

Figure 1: Sample BMP shows texts in graphic mode, 128x64 pixels.

Hardware Schematic

J2 is 24-pin header, you may see the signals on J2, it provides necessary signals for memory mapped I/O expansion. Those signals include:

Data bus: D0-D7,
Address bus:  A0-A4, A8,A9,A10, and A15,
Control bus: /RD, /WR, RESET, /INT0, /INT1,
Power supply: +5V and GND.

The data bus, D0-D7 signals are tied to both FT245BM and GLCD data bus directly.

Figure 2: Hardware schematic  of the expansion board.

The enable signal for USB chip and GLCD controller were made by PLD decoder from the address lines. As we have seen the memory map for i/o of 8051SBC board, the available space is from 0x0300-0x07FF. The address range of 0x0300-0x03FF was used for USB chip for both RD and WRITE operations. The GLCD used 0x0400-0x04FF with A0-A3 for selecting the internal registers from 0x0404-0x040B.

We have learned from 8051SBC on how to use PLD as the memory decoder. In the schematic you may see the equivalent logic symbol for each enable signal. Let study the logic equation shown in Figure 3 and the equivalent logic circuit, you will understand how easy it is.
; USB8051SBC PLD Equation
; Memory and I/O decoder for USB&GLCD expansion Board
; Wichit Sirichote,
; Dec 13, 2003
; PLD: Lattice GAL16V8D

 a15=1 rd=2 wr=3 a8=4 a9=5 a10=6 glcd_enable=17 rd_usb=18 wr_usb=19 RST=7 LCD_RST=16


/glcd_enable = rd * wr + a8 + a9 + /a10 + a15

/wr_usb = /a8 + /a9 + a10 + a15 + wr

rd_usb = /a8 + /a9 + a10 + a15 + rd


Figure 3: PLD Equation for GAL16V8D.

Board Layout

Figure 4 shows the sample layout made by universal pcb. We see that with a PLD, the glue logic will be put together in PLD chip. The left-hand, J4 is 26-pin connector for USB board. And the bottom connector, J3 is 20-pin SIP connector for GLCD board. The right-hand connector J2 is for 8051SBC expansion header. Upper is manual switch for backlight turn on/off.

Figure 4: The prototype made with universal pcb and PLD.

Ezy USB-M01 Board

Figure 3 shows the USB module made by Astron Logic Company. The evaluation kit consists of USB board, user manual, cable and software CD for driver and test software. The kit is available at low-cost, to get it please contact Astron Logic directly.

The USB board is based on FT245BM. The chip provides complete hardwire USB protocol that conforms USB1.1 and USB 2.0 (full speed mode). The FT245BM can learn more from Future Technology Devices International: FTDI.

Figure 3: The Ezy USB-M01, USB module by Astron Logic.

128x64 Graphic LCD

The graphic LCD is based on Samsung KS1208 or Hitachi HD61202 controller. The address of internal registers were mapped into external memory from 0x0404-0x040B. To access them we can use pointer with absolute address directly. The testing code is just display BMP file. However some function can be modified for the application purpose. More sample code and GLCD datahsheet can get from 128x64 Graphic routines and tools for GLDC.


The USB test code is shown in Figure 4. As shown in schematic, the usb port is mapped to 0x0300.
To enter sending data, the main program will check S2 user keypad on the 8051SBC. When we press it, the program will enter checking TXE.

When TXE signal becomes LOW it indicates that the FIFO buffer is available for data to be received. In the main code it test P3.3 with 0x08 MASK byte to AND with P3. If it low, the variable n will write to usb buffer through the pointer *usb_port.

On receiving, instead of polling TXE signal, the RXF signal was tied to INT0 pin. When RXF actives, it will make interrupt ex0 to service. The data was read easily with pointer *usb_port. We can see the data shows on the on board text LCD.
   usb.c Test code for USB and GLCD expansion board for 8051SBC V1.0
   The usb board is FT245BM based.
   copyright 2003,2004 W.SIRICHOTE

#include <8051io.h>  /* include i/o header file */
#include <8051reg.h>
#include <8051int.h>

#include "lcddrv.c"

char *usb_port;
char buffer,n;

#define GPIO2 (*((unsigned char *)0x0200))

// read byte from usb module, print on LCD

INTERRUPT(_IE0_) external0_interrupt()
             buffer = *usb_port;

    usb_port = 0x0300;
    buffer = -1;
    n = 0;
    IE = 0x81;
    TCON |= 1; // negative going detection
    Puts("USB Testing");
       ;    // wait until TXE low
      *usb_port = n++;

Figure 4: Test code for USB board.

To test with host PC, the enclosed CD has test software. When we tie usb connector of the expansion board to a PC's usb port. We can select device then. After open the device, when we press S2, it will send data to PC and the received window will show the byte being received, e.g. 0,1,2,3,4,5,6,... Also for sending, you can type text in Send immediate window, the ASCII letter will show on 8051SBC's LCD while typing!

Figure 5: USB data communication test software.

The graphic LCD test code is now under developing. I will put it when available soon. Below sample code for GLCD is just to print the three images with delay one by one.

Schematic usb.pdf
Test program for USB usb.c
Test program for GLDC gtest.cglcddrv.c
betty.img 8051.img welcome.img
Intel Hex files for USB USB.HEX
Intel Hex files for GLCD GTEST.HEX
OrCAD 9.1 Schematic
Equation and JEDEC files for GAL16V8D USB8051.EQN

19 December 2003

Recovered 17 December 2015