S100 Computers

HomeS-100 Boards HistoryNew BoardsSoftwareBoards For Sale
ForumOther Web SitesNewsIndex   
  
An S-100 Bus Dual SD Card Board.  
Undet Construction 
Prototype Board
 
Introduction
Our Dual IDE/CF card board first done back in 2011 has turned out to be a popular and reliable board. Over 300 of them have gone out world wide over the years.
However CF cards are now not often used these days. more common are the smaller SD cards.  This board utilizes two SD cards instead of two CF cards.
The board is driven by an onboard ESP32 S3 module.
Instead of the now rare HEX LED displays I have switched over to the now common OLED displays to show CPM Track/Sector etc.
Like our FPGA disk controller boards (e.g. the FPGA_DC Boards) all access to the SD cards is done via a few one byte commands sent to the board.
These commands are processed by the ESP32 and send/receive sector data to the S100 bus over two parallel ports. 
The two ports are completely configurable to any 8 or 16 bit port number wit two dip switches. The default ports are 80H and 81H.


What Is Needed
The ESP32 modules we will use need to have plenty of GPIO pins since we need two parallel ports and status lines to the S100 bus.
Here are two examples:-
  
    ESP32-S3
   
  ESP32 module 2
  
There are quite a few others on Amazon etc. but it is very important to be sure the same GPIO pins on these modules (which are the same) is exactly the same on any other ESP32 module you use (or else alter the Arduino.ino file).
Here are diagrams of the pinouts:-
   
       WROOM Pinout                     Waveshare Pinout

The are numerous small OLED displays these days. I use here a 1.54 Inch OLED Module 12864 128x64 SSD1309 LCD Display. It is available from a number of suppliers.  I got mine from Amazon.
The ESP32 uses an I2C interface using pins GPIO9 and GPIO8.
   
    OLED Picture

There seems to be a two types where the four connecting pins are GND,VCC,SCL,SDA and VCC,GND,SCL,SDA.  There is a jumper on the board (P3) to accommodate the power for both types. 
Check the voltage on pins P1 and P2 and jumper P25 to match. Only then add the OLED unit.

Note there are also other similar size OLED displays that have more pins and are not I2C driven.  They will not work with thhis board.
There are however larger versions of the 4 pin OLED displays. I have had mixed results getting these to display text completely correctly.

The SD cards themselves are controlled by SD card adaptors.
There are two popular types shown here. The interface will be described below..
        SD Card Asdaptors

The Adafruit has a 5V to 3.3V level shifter so it could be run with just a 5V interface. However the SparkFun does not. All its pins must be 3.3V.

The rest of the boards components are standard -- available from Jameco, Mouser, Digi-Key etc. For prototype boards I generally use "double swipe" IC sockets.
For a critical board like this I prefer to use "Machine Tooled" IC sockets.  However they are more expensive and you have to be particularly careful not to bend the actual IC pins. 


Board Construction
There is nothing particular special about constructing this board.  Use the normal construction process we have in the past. Be careful with LED and electrolytic cap orientations. The longer lead goes into the square hole.
Check also the orientation of resistor networks.

The Pololu 5V exist in a few forms. While the older ones (D24V25F5) are still available and uses P6, it seems Pololu is suggesting users use the newer D24V22F5's (5V, 2.5 Amp) units, it has a different pinout, use this one in P4. 
The ESP32 S3 module supplies enough current to drive all the 3.3V board chips.

   
Without any chips on the board pop the board into the S100 bus and check you are getting 5V going to each IC socket that uses 5V.
If this is OK install all IC's to the board, including the ESP32_S3 module  (in sockets
P2+P5). There is a second socket P15 to accommodate some ESP32 modules that have a slightly wider spacing. (P15 = P5).
Note the ESP32-S3 is mounted on the board upside down so the USB port connection is easily available when the board is in the S100 bus.

Jumper K1 1-2 for an 8 bit port address. Set the two dip switches as shown here to select ports 80H and 81H.
   
    Dip Switches

Jumper P1 1-2 and 3-4 (vertical).
Leave all pins on P13 free.
The most common OLED displays use P3 4-6 and 1-3.
K2 (board reset), is normally is 1-2.


How the Board Works
Before going further open the board schematic (see below) and study it to understand how the board works.

In summary:-
In the default configuration the four S100 bus ports  are 80H (IN & OUT) for status bits and 81H (IN & OUT) for data ports.
  
    Schmatic 1

Whenever the S100 bus writes a byte to port 81H the bus D00-D07 lines are latched into U9.
At the same time S100_WRITE_ENABLE  clocks the Flip Flop U6A which ends up as a high on the ESP32 GPIO20 pin.
The EESP32 continuously looks at GPIP_20. If it is high it realizes S100 bus data is available.
After the ESP32 reads the 8 bits on U8 it pulses its GPIO_2 pin low. This resets the U6A Flip Flop and now lowers GPIO20 indicating the byte of data has been read.
This process is done reputedly for all data coming to the ESP32.

Whenever the S100 bus reads a byte send by the ESP32 to port 81H the bus DI0-DI7 lines are read via U15. They are latched into U15 by the ESP32 GPIO_1 pin.
The ESP32 GPIO_1 pin also sets the Flip Flop U6B  which goes on to raise bit 0 of port 80H (DI0) of U14.
Once the S100 bus reads the data from U15 (S100_READ_ENABLE) it also resets the Flip Flop U6B.
The ESP32 also looks at pin GPIO_21 on U10 which tracks when the data on U15 was read.
Another byte of data from the ESP32 is never sent until the previous byte was read by the S100 bus.

This handshaking has to be rock solid because every sector (512 bytes) of data passes back and forth between the SD card and the S100 bus.
Because the ESP32 has a clock of up to 240MHz even with the overhead of Arduino code (see below) the data transfer process is very fast.

There are two slight complications however.
The ESP32_S3 is driven by the Arduino library code.
The normal Arduino library is built to assess MSDOS files directly.  It assume a FAT formatted disk with MSDOS file names etc.
This board can be used to assess SD card data via a MSDOS file structure but for CPM we really want to be able to read and write to the SD card sectors directly.
This is not a common situation with Arduino programs.
After a lot of trial and error I discovered two Arduino functions that can access SD card 512 byte sectors directly.
They are
SD.writeRAW(buffer,sector) and SD.readRAW(buffer,sector). See the Arduino code below.

That above SD library unfortunately also assumes only one SD card is utilized in the default library.  
We have two SD cards!  While we can use the SD card adaptor CS* pin to select each individual SD card module it appears the card data return signal
MISO is always active.
The two card MISO signals interfere with each other before going into the ESP32.
We get around this by isolating the signal from each card with the following circuit:-
   
     Two SD cards

The ESP32 GPIO_47 pin controls which card CS* is active and which card MISO gets to return data to the ESP32 via GPIO_12.

The rest of the board is fairly straightforward, The OLED display uses an I2C interface from the ESP32 (pins GPIO_8 and GPIO_9).
There is also a "spare" four pin socket for a second I2C device. I had intended to add one of the Real Time Clock modules (e.g. the Adafruit, PCF8523), but this is not currently implemented.

The Arduino ESP32 Code
One very nice thing about these ESP32 modules is that the popular Arduino IDE interface can be used to program them.
With this board you need to configure the interface/tools/board to be an
ESP32 S3 Module.
Hookup USB connection to your computer. You need to also let the Arduino IDE which "COM" port is connected to your computer.
The Arduino code utilizes a few libraries and .h files:-

#include "FS.h"
#include "SD.h"
#include "SPI.h"
#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
#include "fonts\TimesNewRoman16.h"
#include "fonts\X11fixed7x14B.h"

If you are not familiar with using the Arduino IDE and the ESP32 you should first see a few YouTube demos. For example here.
The one tricky part is writing code to read and write to the S100 bus 8 bit parallel ports. (The ESP32 does not have a direct port input).
Here is the code:-

void Output_PARALLEL_Port(char PARALLEL_value){
gpio_set_level(GPIO_NUM_42, (PARALLEL_value & 0x80) >> 7);
gpio_set_level(GPIO_NUM_41, (PARALLEL_value & 0x40) >> 6);
gpio_set_level(GPIO_NUM_40, (PARALLEL_value & 0x20) >> 5);
gpio_set_level(GPIO_NUM_39, (PARALLEL_value & 0x10) >> 4);
gpio_set_level(GPIO_NUM_38, (PARALLEL_value & 0x08) >> 3);
gpio_set_level(GPIO_NUM_37, (PARALLEL_value & 0x04) >> 2);
gpio_set_level(GPIO_NUM_36, (PARALLEL_value & 0x02) >> 1);
gpio_set_level(GPIO_NUM_35, (PARALLEL_value & 0x01));
gpio_set_level(GPIO_NUM_1,HIGH);                                               // pulse U15 LE high
gpio_set_level(GPIO_NUM_1,LOW);                                               // return U15 LE low
}

char Input_PARALLEL_Port() {
char PARALLEL_value;
PARALLEL_value =
digitalRead(GPIO_NUM_4) +
(digitalRead(GPIO_NUM_5) << 1) +
(digitalRead(GPIO_NUM_6) << 2) +
(digitalRead(GPIO_NUM_7) << 3) +
(digitalRead(GPIO_NUM_15) << 4) +
// (digitalRead(GPIO_NUM_16) << 5) +
(digitalRead(GPIO_NUM_19) << 5) +
(digitalRead(GPIO_NUM_17) << 6) +
(digitalRead(GPIO_NUM_18) << 7);
gpio_set_level(GPIO_NUM_2,LOW);                                                // pulse U15 LE high
gpio_set_level(GPIO_NUM_2,HIGH);                                               // return U15 LE low
return(PARALLEL_value);
}

Once setup the ESP32 sits in a continuous loop waiting for 8 bit commands coming from the S100 bus. They are:-
 
80H        Initilized the SD Card A: for sector R/W
81H        Initilized the SD Card B: for sector R/W
82H        Read a specified sector
83H        Write to a specific SD card sector
84H        Format CPM directory sectors
85H        Reset the ESP32 module.
 
Each command has a specific format of an initial 33H byte, the one byte command listed above and for sector R/W the sector number (0-FFFFH).
The hardware above clocks each byte back and forth between the S100 bus and the ESP32/SD card.

S100 Bus Test program

In order to test this board I have written a short Z80 program (
SD_CARD.Z80) to run at 100H in RAM.
Load SD_CARD.COM (see below), to RAM at 100H with the Master monitor
X command.
Then type G100, you should see:-  
        
     SD card Program
 

Before an SD card can be accessed it must be "Initilized" by the program. This allows Arduino/ESP32 to determine the card type etc.

You should then be able to read a specified sector on that card.
  
    Sector Display
 
The OLED Display will show the current CPM Track and Sector.
  
    OLED Data Diaplay

Note in teh default configuration the board assumes
0FFH CPM tracks with 0FFH sectors/track.

A Production S-100 Board.
Realizing that a number of people might want to utilize a board like this together with a group of people on the  Google Groups S100Computers Forum, "group purchases" are made from time to time. 
Please see here for more information on older boards.
   
    
The links below will contain the most recent schematic of this board.
Note, they may change over time and some IC part or pin numbers may not correlate exactly with the text in the article above.

MOST CURRENT  SD CARD_BOARD SCHEMATIC               (V1.0     11/20/2024)
MOST CURRENT SD_CARD_BOARD  KiCAD Files              (V1.0    11/20/2024)
MOST CURRENT SD_CARD_BOARD GERBER Files                (V1.0     11/20/2024)
BOM for SD_CARD_BOARD                                            
 (11/20/2024)  

 

ESP32-S3 Arduino Code                 
Code to program the ESP32 S3 Module to R/W SD card sectors                                         (11/20/2024)


Other pages describing my S-100 hardware and software.

Please click here to continue...

This page was last modified on 11/20/2024