68kSingle Board Computer

Wichit Sirichote, kswichit@kmitl.ac.th

Build a 32-bit power single board computer. The board fetures 68HC000 @ 8MHz, 256kB FLASH, 256kB SRAM. Available now schematic of DTACK and decoder that use CPLD.
FinallyI got the problem with the limited resource of 8-bit microprocessor. Oneof my experiment needs the computing power between 8-bit and 32-bit cpu.For 8-bit applications I used MCS51 and AVR. Whereas the 32-bit applications,I used embbeded PC running linux. So I chose the cheap 32-bit cpu fromMotorola, the 68HC000. The chip is quite old but there are many chip makersstill produce it. I like the addressing modes of 68000 cpu. So I spentmy hobby time a couple of month to design the hardware and develop a simplemonitor program.

Figure1: The prototype of 68k Single Board Computer.

The 68000 Single Board Computerfeatures:

HardwareSchematic

Figure 1 shows the completehardware schematic of the 68k SBC. U1 is 68-pin PLCC 68HC000 CMOS cpu.Y1 is 8MHz oscillator module. The reset signal is generated by power onreset chip, MCP120. The 16-bit data bus, D0-D15 are tied to memory chipsdirectly. D0-D7 are tied to odd byte and D8-D15 to even byte. As can beseen in the schematic, I used 512kB FLASH, 29C040. It needs A1-A19 addresslines. But the prototype used only 128kB FLASH, 29C010. It needs only A1-A17.Since the 29C0101 does not use pin 30 and 1, so we can put it to the boardwithout the need of modification.

Figure2: Complete hardware schematic of 68k Single Board Computer.

Similarly for SRAM interface,but if the 128kB SRAM was used instead of 512KB, the layout needs to modifyat pin 30. For 128kB SRAM this pin must tie to +5V. For odd and even bytes,the signal wiring of data bus is the same as FLASH. U9 CPLD Xilinx 9572provides the memory decoder and DTACK genration signals. It can replacea number of glue logic. The schematic files for U9 is test1.sch and theXilinx foundation software will produce the JEDEC file from the schematic.You may learn from test1.sch for the details of how DTACK and some of theglue logic work.

U11 is for simple memorymapped I/O decoder signals. The schematic file is 68kio.sch. U13 and U14are 8-bit input/output ports. The serial port is 6850 UART. It providesterminal interface with 9600 8n1 format. The clock for TxD and RxD is 153600Hz.Since the 6850 needs 16x frequency to give 9600 BAUD. The divider implementedby U9 is (8MHz/13)/4 or 153846Hz. This frequency gives BAUD = 153846/16=9615, which is all right for 9600 BAUD.

XilinxXC9572 CPLD

I used Xilinx foundationsoftware F2.1i, Build 3.1.162 for CPLD programming. The software includeIDE for schematic editor, simulator, compiler and JTAG programmer. As seenin the schematic JP1 and JP2 are 8-pin JTAG headers.

CheapJTAG Cable

The JTAG porgrammer cablecan be made easily with Cheap JTAG Cable. The link below shows how to builda cheaptag for Xilinx CPLD programming,  http://warmcat.com/milksop/cheaptag.html

MonitorProgram: Commands

The monitor program was developedusing C32. The 68k SBC communicates with host PC via 9600 serial interface.Figure 3 shows the help menu when power up the board.
 

zBug V1.0 for 68000-Based SingleBoard Computer

100000>? monitor commands

A   About zBug V1.0
B   Boot from RAM [100000]-> SP [100004] ->PC
C   Clear memory with0x0000
D   Disassemble machinecode to mnemonic
E   Edit memory
F   Fill memory with 0xFFFF
H   Hex dump memory
J   Jump to address
L   Load Motorola s-record
N   New 24-bit pointer
R   Register(user) display
S   Stack(user)'s content
T   Trace instruction
.   Modify user registers,exp .PC .D0 .A0
?   Monitor commands list

100000>
 

Figure3: Startup menu of zBug V1.0.

You may load the motorolas-record and jump from monitor to application program in RAM.
 

zBug V1.0 for 68000-Based SingleBoard Computer (press ? for help)

100000>load Motorola s-record (accepts2 and s8) quit: ESC

                           SEnding file D:LED.HEX
____________

188 bytes loaded, 0 records checksumerror

100000>jump to user program 100400>110000
 

Figure4: Load s-record and jump to application program.

The command 's' displaysuser STACK content with 16-word deep.
 

100000>stack (user)'s content, shows16-WORD deep

      1370D4 [D05C]
      1370D6 [21B0]
      1370D8 [2805]
      1370DA [E100]
      1370DC [16A8]
      1370DE [BA20]
      1370E0 [20AA]
      1370E2 [60E1]
      1370E4 [A01E]
      1370E6 [A429]
      1370E8 [C2E1]
      1370EA [C531]
      1370EC [2760]
      1370EE [6A11]
      1370F0 [0011]
      1370F2 [0020]
TOS--->1370F4 [1C73]

100000>
 

Figure5: User STACK display with command 's'.

The command 'd' will disassemblethe machine code to nmemonics.
 

110000>disassemble machine codeto mnemonic

110000    41F900700001        LEA.L   $00700001,A0
110006    207C00700001        MOVE.L  #7340033,A0
11000C    615A                    BSR.S   $110068
11000E    103C0001              MOVE.B  #1,D0
110012    343C0003              MOVE.W  #3,D2
110016    4600                     NOT.B   D0
110018    1080                     MOVE.B  D0,(A0)
11001A    4600                     NOT.B   D0
11001C    61000040              BSR.L   $11005E
110020    E318                     ROL.B   #1,D0
110022    0839000000600001  BTST    #0,$00600001
11002A    6626                     BNE.S   $110052
11002C    51CAFFE8              DBF.L   D2,$110016
110030    343C0003              MOVE.W  #3,D2
110034    4600                     NOT.B   D0
110036    1080                     MOVE.B  D0,(A0)
110038    4600                     NOT.B   D0
11003A    61000022               BSR.L   $11005E
11003E    E218                     ROR.B   #1,D0
110040    0839000000600001  BTST    #0,$00600001

110048>
 

Figure6: Disassemble machine code (based on tutorX68) to mnemonics with command'd'.

MonitorProgram: source code

The monitor source code isT68K.ASM. While I was developing the software, I found the tool to helpsplit the binary image into two files, i.e. odd and even bytes files. Sowhen assemble the source code, I must let the assembler produced BIN imagefile. With C32 Cross Assembler V3.0, we can use directive HOF as follows;

CPU    "68000.TBL"      ; CPU TABLE
HOF    "BIN16"          ; HEX OUTPUTFORMAT

Toassemble the T68k.asm, we type command line as follows;

d:\c32\c32T68k.asm -h T68k.bin -l T68k.lst

Theoutput file is T68k.bin will be binary image! Now we can use SPLIT2.exeto split it into ODD and EVN files.

D:\C32>split2

Inputsource file name: t68k.bin
Outputeven file name[t68k.EVN]:
Outputodd file name[t68k.ODD]:

Filewill be split to t68k.EVN,t68k.ODD
2ways splitting now...
Ok

D:\C32>

Thosefiles, ODD and EVN files can then be programmed into FLASH memory usinga given EPROM programmer. I used Willem's EPROMER to program the FLASH29C010.

NowWhat's the RAM file, U68K.ASM for monitor porgram?

Itis the same monitor program but it was relocated from ROM address to RAMspace, so developer can write new command and test the code before switchit to ROM space.

Nowwe can produce Motorola s-record, no need to split it. Since it can downloadinto RAM and test run under the main monitor program. We use HOF "MOT16"instead.

  CPU     "68000.TBL"      ;CPU TABLE
 ; HOF     "BIN16"         ; HEX OUTPUT FORMAT
  HOF     "MOT16"         ; OUTPUT MOTOROLA S-RECORD

Youmay study the vector address of reset and interrupts to see the offsetsetting between ROM and RAM version. After download the u68k.hex into RAM,you can reboot in RAM mode monitor by command 'b'.
 
100000>load Motorola s-record (accepts2 and s8) quit: ESC

                           SEnding file D:U68K.HEX
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________

11205 bytes loaded, 0 records checksumerror

100000>
 
 
 
 

zBug(RAM) V1.0 for 68000-Based SingleBoard Computer (press ? for help)

100000>

Figure7: Boot in RAM mode for monitor code developing.

Youmay noticed now, the title message shows zBug(RAM) instead of zBug V1.0.To exit the RAM mode, just press reset key.

Whenthe test is OK, you may change the location of start program from ORG RAM+0to ORG 0.

  ORG RAM+0
  DFL SUPER_STACK        ; TOP OF SUPERVISORSTACK $130000
  DFL MAIN
  DFL BUS_ERROR
  DFL ADDRESS_ERROR
  BRA SERVICE_ILLEGAL     ; DFL ILLEGAL_INSTRUCTION

  ORG RAM+$24
  BRA SERVICE_TRAP0      ; THE SAME AS TRAP #0
 

  ORG RAM+$80
  BRA SERVICE_TRAP0
---------------------------------------------------------------------------------------U68k.asm ----------------------------------------------
  ORG 0
 DFL SUPER_STACK        ; TOP OF SUPERVISORSTACK $130000
  DFL MAIN
  DFL BUS_ERROR
  DFL ADDRESS_ERROR
  DFL ILLEGAL_INSTRUCTION

  ORG $24
  DFL SERVICE_TRAP0      ; TRACE THE SAME AS TRAP#0
 

  ORG $80
  DFL SERVICE_TRAP0      ; TRAP #0
-------------------------------------------------------------------------------------T68k.asm------------------------------------------------

Note:Remember the split2 needs binary image, not hex file, so you must producethe BIN file from T68k.asm using,

d:\c32\c32T68k.asm -h T68k.bin -l T68k.lst

Thenprogram the bin file for odd and even FLASH. Put the odd into D0-D7andeven to D8-D15 sockets!

Errata

I got many requests on VHDL or schematic design for XC9572 CPLD. I have captured the schematic and provided the schematic in GIF files. You may learn how do I design DTACK generation, decoder, UART clock. Click at the picture below for GIF zip file.

Figure 8: Schematic design of DTACK, decoder, clock for UART and VME.

Download
 
Schematic 68ksbc.pdf
Test program LED.ASMLED.HEX
zBug V1.0 Monitor program (ROM file) T68K.ASM
zBug V1.0 Monitor program (RAM file)
start address is $100400
U68K.ASM
U68K.HEX
Disassembler code and IMAGE file DIS.ASM
DIS.IMG
BIN file of zBug V1.0 T68K.BIN
Program that splits BIN file into ODD and EVEN files SLIT2.EXE
monitor BIN file for ODD and EVEN bytes T68K.ODD
T68K.EVN
OrCAD 9.1 Schematic, BOM orcad68k.zip
OrCAD 9.1 MAX and gerber files 68kgerber.zip
Schematic and JEDEC files for CPLD with Xilinx foundation F2.1i, Build 3.1.162
test1.sch for U9 and 68kio.sch for U11
CPLD.zip
schematic of DTACK and decoder for XC9572 CPLD (GIF files) CPLD_schem.zip

Note:The 68kSBC project is not recommended for beginner. The author suggeststhose who interested in building the board should study "Programming andDesigning with the 68000 Family" written by Tibet Mimar beforehand. Theboard was intended to run with GNU c compiler for the project that needs32-bit computing power!



2 April 2004