Introduction: Using ESP32/VGA32 Terminal for Z80-MBC2
How to build and install the ANSI Terminal software on an ESP32/VGA32 board.
Then connecting it to a Z80-MBC2 board.
You will need a VGA32 V1.4 Controller. Available from places like Ebay etc.
Arduino IDE, esp32 support and FABGL libray (see instructions bellow)
A PC to run the compiler on. Any Linux/Mac OSX/Windows should be ok.
Step 1: Software Basics
1, Install Arduinio IDE
Download from: https://www.arduino.cc/en/Main/software
2, Add the ESP32 support pack.
The expressif instructions can be found here: https://github.com/espressif/arduino-esp32/blob/m...
You can also search for terms like “add esp32 to Arduino” or “Using esp32 with Arduino” and you will find lots of info on how to do this.
Step 2: Adding Software, the FABGL Libray
Add the FABGL library.
1, You need to access the library manager to add this library. The simplest way I have found is to create a new blank project (you can discard it after you have finished this step). Then use the Tools menu Boards: option. Set your ESP32 board type and Serial port etc. If you are unsure of the board to choose, for this step, you can use any of the generic types since you will not be using this dummy project again.
2, Use the sketch menu to choose “include library”, then choose “library Manager”. That takes you to the library manager screen.
In the search space (top row, right hand side) Type in FABGL, after a few seconds the screen will show the library, then choose install.
Once this is done you can discard the dummy sketch.
Step 3: Loading the ANSI Terminal Sketch
Create the Ansi Terminal Sketch
1, Use the File, Example menu. Navigate to FABGL, VGA, ANSI Terminal example.
2, You can test it has all the correct setup by compiling it - use the tick icon. It should compile ok at this point, takes a little while to finish.
Step 4: Upload the Sketch
Upload to the VGA32 module
You can use all the default setting to get the board working, at some point you may choose different pins for the TX/RX connections if you wish. Look through the example sketch to see what you can do.
Know use the -> icon to compile and upload the sketch.
If you have connected a VGA monitor, after the board has reset you should have a menu and info on the screen. Again if you have connected a keyboard press F12 to configure your new terminal.
(Sometimes you have to reset the board to get the keyboard to work, especially if you plugged it in after the sketch was uploaded)
Step 5: Connecting to the MBC2
Connect to your MBC2
At this point I assume you have already devised a method of connecting to the VGA32 board. In my case I soldered a header in place to allow connecting to a bread board.
Look closely at the board silk screen pin I/o - choose the correct io pins, should be IO34=RX IO2=TX GND=GND.
Warning: on my board the silk screen was printed backwards on the underside of the board. So the line of text referred nearest the pins referred to the nearest and not the corresponding row as expected. This meant the silk screen row furtherest from the pins referred to the furthest away set of pins. A sort of 1-2-2-1 pattern instead of the 1-2-1-2. Very confusing.
Step 6: Logic Levels and Connections
Connect the TX pin from the VGA32 board directly to the MBC2 that’s from 3.3v -> 5v no need for a converter.
Connect GND to GND
At this point I used a bread board to hold the two resistors, on the circuit above. In the final version you can put these resistors on a small vero board.
Connect RX to the point marked 3.3V (above) and then connect the point marked 5V to the MBC2
NOTE It appears on my MBC2 that the pins are marked to show what they connect too on a normal USB/serial adapter and not what the pins function is, this is the reverse of what you may expect, so the connections end up like this:
VGA32. MBC2 TX. -> TX GND. -> GND RX -> resistors -> RX
Thats it you should be good to go.
Step 7: Further Info Page
The pin out and naming conventions on various bits of equipment (in this case the z80-mbc2 and the tvga card) can be very confusing.
For example some kit has markings indicating what pin you should connect this to, to me, this is the reverse of the convention of labelling pins as to what they are, ie what connects to them.
The best way I have found to clarify this (i hope) is to measure the voltage on the pin in question, since the serial protocol has high it's it's idle state - if you measure a "high" voltage (3.3v or 5v) then this is the TX pin. where the signal originates from.
And if the voltage is low (less than 1v, and probably fluctuating slightly) this would indicate an input (RX) where the data goes to.
So i ignored completely the silk screen, the software library names etc and measured a above, the result is the hand drawn diagram above. And it works for me (some of the older TVGA cards may use different IOpins)