This is the EMDP3 bus specification for the EMDP3 system and it is currently a work in progress.

EMDP3 Bus

Table of Contents

1.0 Introduction

The EMDP3 bus is a 37 wire bus. Some of the wires are allocated for power distribution, some are used for adaptor and rewiring plug identifaction and the remaining wires are used for general purpose device programming.

2.0 Bus Overview

Table below summarizes what each pin of the EMDP3 is used for.

CUMP Bus (Rev.4)
DB37 Pin # IDC Pin # Signal Name IDC Pin # DB37 Pin #
1 1 TX/BD0 BD1/RX 2 20
2 3 BD2 BD3 4 21
3 5 BD4 BD5 6 22
4 7 BD6 BD7 8 23
5 9 ICP/BD8 BD9/OCP 10 24
6 11 PP0/BD10 BD11/PP1 12 25
7 13 PP2/BD12 BD13/PP3 14 26
8 15 PP4/BD14 BD15/PP5 16 27
9 17 PP6/BD16 BD17/PP7 18 28
10 19 PCK#/BD18 BD19/RW# 20 29
11 21 ALE#/BD20 BD21/DBR 22 30
12 23 IRQ#/BD22 BD23/SDI 24 31
13 25 GND BD24/SDO 26 32
14 27 5V BD25/SCK 28 33
15 29 VIO BD26/SCL 30 34
16 31 VAR2 BD27/SDA 32 35
17 33 VAR1 BD28/VCK 34 36
18 35 IDD BD29/IDL 36 37
19 37 IDC NC 38 n/a
n/a 39 NC NC 40 n/a
Abrev. Description
VAR Variable Voltage
VCC Supply voltage (5V/3V?)
GND 0V
BD BiDirectional signal
PP Parallel Port signal
E Parallel Port Enable (aka parallel port clock)
RW Parallel Port Read/Write signal
ALE Parallel Port Address Latch Enable
SDA IIC Serial Data
SCL IIC Serial Clock
SDI SPI Serial Data In
SCK SPI Serial Clock
SDO SPI Serial Data Out
VCLK Variable Clock source
TX UART data send (MB centric)
RX UART data receive (MB centric)
IDC Serial ID clock
IDD Serial ID data
IDL Serial ID load
IRQ Interrupt Request
NC Not Connected

The material below is OUT OF DATE!!!


3.0 Bidirectional Lines

There are 30 EMDP3 bus lines that are set asside for general purpose device programming:

BD1-BD30 (BiDirectional 1 - BiDirectional 30)
General purpose bidirectional lines.
Each BDx line can be individually set to be a digital input or an output.

Some of the bidirectional lines have overloaded functions that can be assigned to them. These alternate functions are listed below:

Parallel Bus
The parallel bus is an 8-bit bus that is used to 8-bit latches and buffers.
Serial Bus (I2C and SPI)
Some devices use the popular I2C and SPI buses for device programming. Since some EMDP3 bases have hardware support for these two protocols, they have been assigned to two specific pins on the EMDP3 bus. If a given EMDP3 base microcontroller does not have hardware support for either of the two protocols, it can "bit bang" the protocols instead.
Selectiable Clock
Some devices need a clock signal to get the internal circuitry prepared for programming. The selectable clock pin can be programmed to generate up to 8 different clock rates up to 1 MHz.
Serial Communication (RX and TX)
It is concievable that some adpators will choose to have on board microcontrollers to do specific device dependent operations. The on board microcontroller chip can communicate with the host software via the the RX and TX pins on the EMDP3 bus.

3.1 Overloaded Parallel Bus

14 bi-directional lines and one other line (STB) are used to implement the overloaded parallel bus. The overloaded parallel bus serves two purposes:

It is the overloaded parallel bus that allows the base to be implemented using a microcontroller with 33 I/O pins.

The overloaded parallel bus consists of the following lines:

Number Name
8 D0, ..., D7
4 A0, ..., A3
1 RD
1 WR
1 STB
The STB line is not on the EMDP3 bus at all; instead, it is used entirely on the EMDP3 base and never escapes off board.

3.1.1 Accessing Base Ports

The EMDP3 base can have up to 16 ports on its printed circuit board. These ports use D0:7 for data and A0:3 for addressing. The RD and WR lines are not used. To read an on-board port, the microcontroller sets D0:7 to be inputs, outputs the correct address values on A0:3, asserts STB, and reads the value off of D0:7. To write to an on-board port, the microcontroller set D0:7 to contain the data value, A0:3 to have the correct address, and asserts STB. The address implicitly specifies whether STB is a read or a write operation. The RD and WR lines remain unchanged.

The overloaded parallel bus allows the use of a microcontroller that has only 33 I/O lines (e.g. PIC16F877.) This is done by using 30 of the lines for bi-directional bus lines, assigning the UART TX and RX lines for communication with the host computer, and using the remaining line for STB. All other base functions (e.g. busy LED, clock select, etc.) can be done using ports laying off of the overloaded parallel bus.

Whenever the microcontroller needs to access its internal ports, the programming algorithm needs to allow the microcontroller to temporarily `borrow' the bi-directional lines needed for the overloaded parallel bus. This accomplished by having the person that designs the rewiring plug for the algorthm use the overloaded lines primarily for output data and address lines (not control lines.) For example, the 27C080 is a 1MB × 8 EPROM that has 20 address lines and 8 data lines. The plug designer for this chip would probably assign the overloaded parallel bus to the 20 address lines of the 27C080.

Note that whether STROBE is active high or low is not important; it is design decision that EMDP3 base designer makes.

3.1.2 Accessing Plug Ports

The EMDP3 base can access up to 16 ports on the rewiring plug. This transaction requires D0:7, A0:3, RD and WR. STB is not used. To write 8-bits of data, the data is placed on D0:7, a port address is placed on A0:3, and WR is asserted. To read 8 bits of data, the D0:7 is turn into inputs, a port address is placed on A0:3, and RD is asserted. At no point is ever STB asserted.

The RD and WR signals can be either active high or low; this decision is left up to the person who designs the rewiring plug.

3.2 Overloaded Serial Bus

Most higher end microcontrollers have some sort of hardware support for I2C® and/or SPI®. The I2C bus requires two open collector lines SCL and SDA. The SPI bus requires SDO, SDI, and SCK. These lines are mapped so that SCL and SCK are on the same bi-directional line, SDI and SDA are one the same bi-directional line and SDO is on its own bi-directional line.

If the microcontroller does not implement SPI, it can be done via bit-banging (technical term) in software. Likewise, if the microcontroller does not implement I2C, it can be bit banged as well. If the microcontroller implements both SPI and I2C and, the base board designer is responsible for making sure that SCL and SCK are on the same bi-directional line as well as SDI and SDA on another. If the hardware does not support this, the base designer can still opt to implement one in software (probably SPI because it is easier) and the other in hardware. Alternatively, the designer may come up with some clever signal routing hardware that ensures that the right signals are on the right pins. A small DPDT relay is both inexpensive and up to the task. Lastly, the plug designer is responsible for providing the requisite pull up resistors.

3.3 Overloaded Serial Communication

Sometimes adding a few extra 8-bit ports to the wiring plug is not enough, and even more hardware support is required. For this hopefully rare situation, an entire microcontroller can be placed directly on the rewiring plug. This microcontroller is called the plug microcontroller to distinguish it from the base microcontroller.

The RX and TX signals of the plug microcontroller can be connected to the appropriate overloaded bi-directional lines. The base controller arranges so that transmitted bytes via the TX are sent up to the host computer. Received bytes are returned via the RX line are received by the plug microcontroller.

3.4 Overloaded Interrupt

Sometimes there is a condition on the rewiring plug that needs immediate attention. The INT line can be asserted to force the base microcontroller to experience an interrupt.

3.5 Overloaded JTAG

{We really need JTAG support. I do not know squat about JTAG support.}

3.6 Overloaded_Selectable Clock

Some devices require a clock signal to be present on one of the device pins before programming can proceed. The availble clock rates are:

Selector Frequency
0 16 MHz
1 8 MHz
2 4 MHz
3 2 MHz
4 1 MHz
5 .5 MHz
6 .25 MHz
7 .125 MHz
While it would be nice to have a fully programmable frequency synthesizer, it seems pretty reasonable to just take a 1 MHz signal, run it through an 8-bit counter and pick off the divided frequencies. This can be done with just an 8-bit counter (74LS590 or equivalant) and an 8-to-1 selector (74LS151 or equivalant.)

4.0 Identification

There are three wires on the EMDP3 bus set asside for identifying adaptors and rewiring plugs:

IDL (IDentifier Load)
Load the identifier bits into the shift registers.
IDC (IDentifier Clock)
Shift the identifier bits over by one bit in the shift register.
IDD (IDentifier Data)
The current identifier bit in output of the shift register.

Each adaptor has an identifier number that is 1 or 2 bytes long. Similarly, each rewiring plug has an identifier number is either 1 or 2 bytes long. These identifiers have the following form:

Decription Byte1 Byte2
Short Adaptor Id (6 bits) x1ii iiii
Long Adaptor Id (14 bits) x0ii iiii iiii iiii
No Adaptor Present 1111 1111
Short Plug Id (7 bits) 1iii iiii
Long Plug Id (15 bits) 0iii iiii iiii iiii
No Plug Present 1111 1111
The adaptor and plug identifiers are concatenated together to form a combined identifier that is between 2 and 4 bytes long.

The EMDP3 identification scheme is implemented using chips that are compataible with the 74LS165 8-bit parallel to serial converter chip. One byte identifiers are implemented using one such chip and two byte identifiers are implemented using two chips. These chips are quite inexpensive. The serial output of the rewiring plug identifier chips is routed to the input of the serial input of the adaptor identifier chips, thereby forming one larger multi-byte identifier string.

To read the identifer string, an EMDP3 base uses the following procedure.

  1. The IDL line is asserted to force the identifier bits to be loaded into the shift registers.
  2. The IDC line is clocked 8 times to read out the first adaptor identifier byte.
  3. If the second bit is a 0, the IDC line is clocked an additional 8 times to read out the second adaptor identifier byte.
  4. The IDC line is clocked 8 times to read out the first rewiring plug identifier byte.
  5. If the first bit is a 0, the IDC lne is clocked an additional 8 times to read out the second reqiring plug identifier byte.

It is important that the system be able to easily detect when there there is no adaptor present and no rewiring plug present. This is accomplished by having a 10K Ohm pull-up resistor on the EMDP3 base connected to the IDD line. This causes all ones to be read for the adaptor identification byte. Similarly, the input to the adaptor shift register has a 10K Ohm pull-up resistor to cause all 1's to be read if there is no rewiring plug installed into the adaptor.

The first bit of the adaptor shift register can be used to detect whether the device lid socket is closed or not. If there is no easy way to detect such a condition, the bit is not used.

The rationale for using the '165 chip instead of a serial EEPROM is because it avoids the issue of getting the proper identifier loaded into the serial EEPROM. Using the '165 technology allows the adaptor and rewiring plug identifiers to be specified by copper traces running directly into the inputs of the '165 chips; no mistakes are possible.

5.0 Power and Ground

There are 4 wires set aside for power and ground:

GND
Ground (0 volts.)
V5
5 Volts. This supply is used to power the identification chips (i.e. '165 eqivalents.) It can be used for other purposes as well, such as lid open and closed detections.
VV24
Variable Voltage 0 to 24 volts. The voltage can be changed in increments of .1 volts.
VV12
Variable Voltage 0 to 12 volts. The voltage can be changed in increments of .5 volts.

6.0 Bus Connectors

There are two different EMDP3 bus connector strategies and they are listed below:

Board to Board Direct
In board to board direct, an EMDP3 adaptor connects to an EMDP3 base via a 2×20 .1 inch female header on the EMDP3 base and a corresponding 2×20 .1 inch male header on the EMDP3 adaptor. There are no cables involved. The close tolerance afforded by the 2×20 female header (less than .5 inch) makes it difficult to place either of the EMDP3 board in a box and still be able to connect the two boards.
37-pin D Subminiature Connector
The 37-pin D connector method puts a standard female 37-pin connector on the EMDP3 base and a male 37-pin connector on each EMDP3 adaptor. Placing the two connectors at exatly the same height above the table, the two boxex can be plugged into one another without requiring any intervening cable.

Why two options? The answer is because some people will choose to place their EMDP3 bases and EMDP3 adaptors in a box and others will choose to just use bare printed circuit boards.

Ribbon cable numbering is used to associate pin numbers to the EMDP3 bus. The outside cable wire is 1, followed by the next cable wire 2, etc.

7.0 Bus Rationale

The fundamental issue with designing the EMDP3 bus is trading off the conflicting requirements below:

Device Programming Pins
There a number of devices out there that want a large number of I/O pins. This suggests having a very wide bus.
Connector Sizes
Connector sizes above 40 pins are available, but they are big and expensive. This suggests keeping the bus size at 40 or less.
Special Features
Some microcontrollers have hardware support for special features such as I2, SPI, etc. This suggests an even wider bus.
Microcontroller I/O Pins
A microcontroller typically has fewer pins than needed for both the EMDP3 bus and other internal uses. This suggests making the bus thinner.
Basic solution to these conflicting constraints is to have a fairly large set of bi-directional lines (i.e. 30), where many of these lines get reused for other purposes as needed. This is called overloading.

The resulting bus is based on a 37 line bus so that it can be placed on standard DB-37 "D connector". 30 of the 37 lines are bi-directional and the remaining 7 lines are for power, ground, and adpator identification. In addition, just about every bi-directional line is overloaded so that it has an additional use above and beyond bi-directional line. It it is this trick of line overloading that allows the bus to fit in 37 pins rather than closer to 80 pins.


Copyright (c) 2003-2004 by Wayne C. Gramlich. All rights reserved.