Difference between revisions of "ESP32-VGA"

From Land Boards Wiki
Jump to navigation Jump to search
 
(199 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
<video type="youtube">RuGWCMFNtms</video>
 
<video type="youtube">RuGWCMFNtms</video>
  
[[File:ESP32-VGA_P923-72PX.jpg]]
+
[[File:P968-cropped-720pxV.jpg]]
  
 
== Features ==
 
== Features ==
  
 +
* See [[ESP32-VGA Rev 1]] for older rev card
 
* [[ESP32]] Module
 
* [[ESP32]] Module
 +
** 18 Analog-to-Digital Converter (ADC) channels
 +
** 10 Capacitive sensing GPIOs
 +
** 3 UART interfaces
 +
** 3 SPI interfaces
 +
** 2 I2C interfaces
 +
** 16 PWM output channels
 +
** 2 Digital-to-Analog Converters (DAC)
 +
** 2 I2S interfaces
 
* 6-bit VGA color
 
* 6-bit VGA color
 
** 2:2:2 R:G:B
 
** 2:2:2 R:G:B
Line 13: Line 22:
 
** 5V mouse/keyboard
 
** 5V mouse/keyboard
 
** 3.3V to 5V level shifters
 
** 3.3V to 5V level shifters
 +
*** Better than 5V keyboard with series resistors
 
** 10K pull-ups on both sides
 
** 10K pull-ups on both sides
 
* 2 x FTDI connectors
 
* 2 x FTDI connectors
Line 37: Line 47:
 
[[File:esp32-pinout-chip-ESP-WROOM-32.png]]
 
[[File:esp32-pinout-chip-ESP-WROOM-32.png]]
  
==== ESP32 Pin Usage - Rev 1 ====
+
==== ESP32 Pin Usage - Revs 2, 3 ====
 
 
[[File:ESP-32_VGA_Pinout.PNG]]
 
 
 
==== ESP32 Pin Usage - Rev 2 ====
 
  
 
[[File:ESP-32_VGA_Pinout_Rev2.PNG]]
 
[[File:ESP-32_VGA_Pinout_Rev2.PNG]]
Line 68: Line 74:
 
* Video is 2:2:2 - R:G:B
 
* Video is 2:2:2 - R:G:B
  
=== Summing Resistor DAC ===
+
=== Summing Video Resistor DAC ===
  
* 5% resistors are "good enough"
+
* Best values (1%)
* 1V into 75 Ohm VGA load
+
** 422, 845
 +
** 470, 820 are close/standard values
 +
* 0.7V into 75 Ohm VGA load
 
* 3.3V drive
 
* 3.3V drive
 
* ESP32 has [https://www.esp32.com/viewtopic.php?t=5840 40 mA drive]
 
* ESP32 has [https://www.esp32.com/viewtopic.php?t=5840 40 mA drive]
** Uses 10 mA (max)
+
** Uses 8 mA (max)
** R4 = 1.2 mA to -10 mA
+
* Output in 4 equal voltage steps
** R3 = 1.1 mA to -5.3 mA
 
* Output in 4 steps
 
** 0V
 
** 0.3V
 
** 0.65V
 
** 0.96V
 
  
[[File:VGA_Sim_2R.PNG]]
+
[[File:VGA_Sim_2R_Voltage.PNG]]
  
 
== Headers ==
 
== Headers ==
  
=== H1 - 3.3V SRC select ===
+
* The Rev 2 board changes around headers and connectors from the [[ESP32-VGA Rev 1]] board
  
[[File:H1_3p3V_Select.png]]
+
=== H1 - 5V ===
  
* 1-2 = Get 3.3V from ESP32 on-board regulator
+
* The ESP32-VGA can be powered from either the DC Jack or ESP32 USB power
* 2-3 = Get 3.3V from on-board regulator (Default)
+
* '''Warning: Do not power from 5V Power jack and connect USB cable to the ESP32 module at the same time'''
 +
** The ESP32 module has blocking diode to protect the module
 +
*** If the 5V DC jack has a power supply attached with lower voltage it could result in the supplied being shorted between the USB 5V and the DC power jack
 +
*** This is not an issue if the DC power jack is disconnected
 +
* This could be used for an external power switch
  
=== H2 - 5V SRC Select Jumper (Rev 1 Board) ===
+
=== H2/H3 - GVS ===
  
* 5V power options
+
* 3x4 header
 +
* Ground/Voltage/Signal lines
  
[[File:H2_5V_Select.png]]
+
# GPIO35
 +
# GPIO12
 +
# VN/I39
 +
# VP/I36
  
* 2x4 header
+
== Connectors ==
* Care must be taken to install the correct jumpers
 
* USB jumper sends out 5V when a USB cable is connected to the ESP32 module
 
* USB jumper sends 5V into the ESP32 module when there is no USB cable connected to the ESP32 module
 
  
==== Power from DC Jack ====
+
=== P1 - PS/2 Mouse ===
  
* 1-2 = VUSB - Install - 5V goes to ESP (Do not attach USB cable)
+
* DIN 6 connector
* 3-4 = DCIN - Install - Power comes from DC jack
+
* ESP32 pins
* 5-6 = FTDI5V_1 - Do not install
 
* 7-8 = FTDI5V_2 - Do not install
 
  
==== Power from USB on ESP32 module ====
+
<pre>
 +
  MSEDAT  => GPIO27
 +
  MSECLK  => GPIO26
 +
</pre>
  
* 1-2 = VUSB - Install - 5V comes from USB on ESP32 module
+
=== P2 - PS/2 Keyboard ===
* 3-4 = DCIN - Do not install
 
* 5-6 = FTDI5V_1 - Do not install
 
* 7-8 = FTDI5V_2 - Do not install
 
  
==== Power from FTDI #1 (Rev 1) ====
+
* Purple DIN 6 connector
 +
* ESP32 pins
  
* Do not use this position with "most" FTDI cards since they will drive 5V on the Rx/Tx pins
+
<pre>
* 1-2 = VUSB - Install - 5V goes to ESP (Do not attach USB cable)
+
  KBDAT  => GPIO32
* 3-4 = DCIN - Power comes from DC jack - Do not power
+
  KBCLK  => GPIO33
* 5-6 = FTDI5V_2 - Install
+
</pre>
* 7-8 = FTDI5V_2 - Do not install
 
  
==== Power from FTDI #2 ====
+
=== P3 - VGA ===
  
* Do not use this position with "most" FTDI cards since they will drive 5V on the Rx/Tx pins
+
* ESP32 pins
* 1-2 = VUSB - Install - 5V goes to ESP (Do not attach USB cable)
 
* 3-4 = DCIN - Power comes from DC jack - Do not power
 
* 5-6 = FTDI5V_1 - Do not install
 
* 7-8 = FTDI5V_2 - Install
 
  
=== H2 - 5V - Rev 2 ===
+
<pre>
 +
  HSync => GPIO23
 +
  VSync => GPIO15
 +
  R0    => GPIO22
 +
  R1    => GPIO21
 +
  G0    => GPIO19
 +
  G1    => GPIO18
 +
  B0    => GPIO5
 +
  B1    => GPIO4
 +
</pre>
  
[[File:H2_5V_Select_Rev2.png]]
+
=== P4 - Audio Out - RCA Jack ===
  
== Connectors ==
+
* ESP32 pins
  
=== P2/P4 = GVS  - Rev 1 ===
+
<pre>
 
+
  AUD  => GPIO25
* Ground/Voltage/Signal lines
+
</pre>
 
 
# GP13
 
# GP14
 
# GP16
 
# GP17
 
# GP35
 
# GP23
 
# VN
 
# VP
 
 
 
=== P2/P4 = GVS  - Rev 2 ===
 
  
* Ground/Voltage/Signal lines
+
=== J1 - 5V Power ===
  
# GP35
+
* Center +5V
# GP12
 
# VN/I39
 
# VP/I36
 
 
 
=== P3 - VGA ===
 
 
 
* ESP32 pins
 
  
<pre>
+
=== J2 - FTDI #1 ===
  HSync => 23
 
  VSync => 15
 
  R0    => 22
 
  R1    => 21
 
  G0    => 19
 
  G1    => 18
 
  B0    => 5
 
  B1    => 4
 
</pre>
 
  
=== J2 - FTDI #1  - Rev 1 ===
+
* This interface is in common with the USB-to-Serial interface on the ESP32 module
 +
* Pinout
  
 
# GND
 
# GND
 
# RTS (Not used)
 
# RTS (Not used)
# 5V (Power in if [[ESP32-VGA#H2_-_5V_SRC_Select_Jumper|H2 is configured]])
+
# 5V (Not used in Rev 2), Connects to J5 on Rev 3
 
# RX (from card to External FTDI)
 
# RX (from card to External FTDI)
 
# TX (from External FTDI to card)
 
# TX (from External FTDI to card)
 
# CTS (Not used)
 
# CTS (Not used)
  
==== Connect to FTDI card - Rev 1 ====
+
<pre>
 +
  RX    => GPIO3
 +
  TX    => GPIO1
 +
</pre>
 +
 
 +
==== Connect to FTDI card ====
  
 
* Set FTDI jumper to 3.3V
 
* Set FTDI jumper to 3.3V
* Cross-over pins 4 and 5 when connecting to FTDI card
 
  
 
[[File:FTDI_rot.jpg]]
 
[[File:FTDI_rot.jpg]]
  
=== J6 - FTDI #2 - Rev 1 ===
+
=== J3 - FTDI #2 ===
 +
 
 +
* Most recent (2020-02) ANSI terminal uses pin 34 for Rx
 +
* Pinout
  
 
# GND
 
# GND
 
# RTS (Not used)
 
# RTS (Not used)
 
# 5V (Power in if [[ESP32-VGA#H2_-_5V_SRC_Select_Jumper|H2 is configured]])
 
# 5V (Power in if [[ESP32-VGA#H2_-_5V_SRC_Select_Jumper|H2 is configured]])
# RX (from card to External FTDI)
+
# RX (from External FTDI to ESP32 card)
# TX (from External FTDI to card)
+
# TX (from ESP32 card to External FTDI)
 
# CTS (Not used)
 
# CTS (Not used)
  
==== Connect to FTDI card - Rev 1 ====
+
<pre>
 +
  RX2    => GPIO34
 +
  TX2    => GPIO2
 +
</pre>
  
* Set FTDI jumper to 3.3V
+
==== Connect to FTDI card ====
* Cross-over pins 4 and 5 when connecting to FTDI card
+
 
 +
* Set FTDI jumper to 3.3V (image below shows jumper set to 5V which is wrong)
  
 
[[File:FTDI_rot.jpg]]
 
[[File:FTDI_rot.jpg]]
  
=== J3 - PS/2 Keyboard ===
+
=== J3 - FTDI #2 ===
 +
 
 +
* Most recent (as of 2020-02) ANSI terminal uses pin 34 for Rx
 +
* Pinout
  
* Purple DIN 6 connector
+
# GND
* ESP32 pins
+
# RTS (Not used)
 +
# 5V Connects to J5 on Rev 3
 +
# RX (from External FTDI to ESP32 card)
 +
# TX (from ESP32 card to External FTDI)
 +
# CTS (Not used)
  
 
<pre>
 
<pre>
   DAT  => 32
+
   RX2    => GPIO34
   CLK  => 33
+
   TX2    => GPIO2
 
</pre>
 
</pre>
  
=== J4 - PS/2 Mouse ===
+
=== J4 - SD Card ===
  
* DIN 6 connector
+
* Brought to GVS header pins (Rev 1)
* ESP32 pins
+
* Brought to SD Card (Rev 2)
  
 
<pre>
 
<pre>
   DAT   => 27
+
   MOSI  => GPIO17
   CLK  => 26
+
   MISO  => GPIO16
 +
   CLK  => GPIO14
 +
  CS    => GPIO13
 
</pre>
 
</pre>
  
=== J5 - Audio Out - RCA Jack ===
+
=== J5 - FTDI Power out (Rev 3+ board) ===  
  
* ESP32 pins
+
* '''Don't install jumpers if an external FTDI interface is used'''
 +
* Powers external 3.3 interfaces
 +
** Useful to power external [[DTE]] or [[DCE]] RS-232 card
 +
* Install shunt/jumper at F1PWR to connect FTDI #1 pin J2-2 to +3.3V
 +
* Install shunt/jumper at F2PWR to connect FTDI #2 pin J3-2 to +3.3V
  
<pre>
+
[[File:J5_Rev3.PNG]]
  AUD  => 25
 
</pre>
 
  
=== J6 - UART2 - Rev 1 ===
+
== VGA - Resistor Selection ==
  
* Most recent (2020-02) ANSI terminal uses pin 34
+
* ESP32 has a 3.3V driver which can drive more than 10 mA
 +
* Ideal case drive current
 +
** 0.7V (full scale VGA level) into 75 Ohms = 9.33 mA
 +
** 2/3 of the current or 6.16 mA comes from the lower value resistor (digital most significant bit)
 +
** 1/3 of the current or 3.08 mA comes from the higher value resistor (digital least significant bit)
 +
* R-2R values
 +
** Ideal resistor values are 417.9 ohms and 835.7 ohms
 +
** [http://www.brannonelectronics.com/images/STANDARD%20VALUE.pdf Standard value 1% resistors]
 +
** 1% standard values are [https://www.mouser.com/ProductDetail/652-CR0805FX-4220ELF 422 (Mouser)], [https://www.mouser.com/ProductDetail/603-RC0805FR-07845RL 845 (Mouser)] Ohms
 +
*** Get closest values
 +
*** 0V, 0.228V, 0.460V, 0.693V
 +
* Voltage steps are:
  
<pre>
+
[[File:VGA_Sim_2R_Voltage.PNG]]
  RX    => 12
 
  TX    => 2
 
</pre>
 
  
=== J6 - UART2 - Rev 2 ===
+
* Current steps are:
  
<pre>
+
[[File:VGA_Sim_2R_Current.PNG]]
  RX    => 34
 
  TX    => 2
 
</pre>
 
  
=== J7 - SD Card ===
+
== FabGL GPIOs assignment summary - fabgl dev board rev2  ==
  
* Brought to GVS header pins (Rev 1)
+
[https://github.com/fdivitto/FabGL/blob/master/fabgl%20GPIOs%20assignment.txt From here]
* Brought to SD Card (Rev 2)
 
  
 
<pre>
 
<pre>
   MOSI  => 17
+
   VGA
  MISO  => 16
+
    HSync => 23
  CLK  => 14
+
    VSync => 15
  CS   => 13
+
    R0    => 21
</pre>
+
    R1    => 22
 +
    G0    => 18
 +
    G1    => 19
 +
    B0    => 4
 +
    B1   => 5
 +
 
 +
  Audio
 +
    AUD  => 25
  
=== J15 - 5mm Terminal Block ===
+
  PS/2 - Keyboard
 +
    DAT  => 32
 +
    CLK  => 33
  
* 5V
+
  PS/2 - Mouse
* Gnd
+
    DAT  => 27
 +
    CLK  => 26
  
== FabGL GPIOs assignment summary - fabgl dev board rev2  ==
+
  SDCard - HSPI
 +
    MOSI  => 17 (12 on TTGO/WROVER)
 +
    MISO  => 16 (2 on TTGO, 35 WROVER)
 +
    CLK  => 14
 +
    CS    => 13
  
[https://github.com/fdivitto/FabGL/blob/master/fabgl%20GPIOs%20assignment.txt From here]
+
  UART - UART1 (USB)
 +
    RX    => 3
 +
    TX    => 1
  
 +
  UART - UART2
 +
    RX    => 34
 +
    TX    => 2  (not usable on TTGO/WROVER with SDCard active)
 +
</pre>
  
 
=== I2C (not usable with VGA) ===
 
=== I2C (not usable with VGA) ===
  
 
<pre>
 
<pre>
   SDA  => 4 (conflicts with VGA B1)
+
   SDA  => GPIO4 (conflicts with VGA B1)
   SCL  => 15 (conflicts with VGA VSync)
+
   SCL  => GPIO15 (conflicts with VGA VSync)
 
</pre>
 
</pre>
  
Line 286: Line 316:
  
 
<pre>
 
<pre>
   CLK  => 18 (conflicts with VGA G1)
+
   CLK  => GPIO18 (conflicts with VGA G1)
   MISO  => 19 (conflicts with VGA G0)
+
   MISO  => GPIO19 (conflicts with VGA G0)
   MOSI  => 23 (conflicts with VGA HSync)
+
   MOSI  => GPIO23 (conflicts with VGA HSync)
   CS    => 5 (conflicts with VGA B0)
+
   CS    => GPIO5 (conflicts with VGA B0)
   D/C  => 22 (conflicts with VGA R0)
+
   D/C  => GPIO22 (conflicts with VGA R0)
   RESET => 21 (conflicts with VGA R1)
+
   RESET => GPIO21 (conflicts with VGA R1)
 
</pre>
 
</pre>
  
 
== Software ==
 
== Software ==
  
=== Arduino Programming ===
 
 
* Board : "DOIT ESP32 DEVKIT V1"
 
 
[[File:Ardino_ESP32.png]]
 
 
=== FabGL ===
 
=== FabGL ===
  
Line 316: Line 341:
 
* [http://www.fabglib.org FabGL] - ESP32 Display Controller and Graphics Library
 
* [http://www.fabglib.org FabGL] - ESP32 Display Controller and Graphics Library
 
* [https://github.com/fdivitto/fabgl FabGL Github repo]
 
* [https://github.com/fdivitto/fabgl FabGL Github repo]
 +
* [https://hackaday.com/2020/08/20/esp32-altair-emulator-gets-split-personality/ ESP32 ALTAIR EMULATOR GETS SPLIT PERSONALITY] - Hackaday page
 +
** [https://github.com/wd5gnr/FabGL FabGL derived build]
  
 
==== FabGL Arduino library ====
 
==== FabGL Arduino library ====
Line 324: Line 351:
  
 
==== Using Latest FabGL builds ====
 
==== Using Latest FabGL builds ====
 +
 +
*  Fabrizio does a nice job of keeping his Arduino libraries up to date but if you want a bleeding edge experience, you can download [https://github.com/fdivitto/fabgl his code from GitHub]. Note, he's in active development so things often change.
  
 
Here's how I did it
 
Here's how I did it
Line 333: Line 362:
 
# Compile/download/test the new files. You know it works if you now get sound from Space Invaders.
 
# Compile/download/test the new files. You know it works if you now get sound from Space Invaders.
 
# Save as where you would normally save your Arduino sketches.
 
# Save as where you would normally save your Arduino sketches.
 +
 +
=== Arduino Programming ===
 +
 +
* [https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/ Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)]
 +
* Board : "DOIT ESP32 DEVKIT V1"
 +
** Used Board : ESP32 Dev Module with Tools > Partition Scheme > Huge APP option to run VIC-20 (2022-09)
 +
* DOIT module does not have PSRAM
 +
** Can't run PC Emulator without PSRAM
 +
* If you try to upload a new sketch to your ESP32 and you get this error message “A fatal error occurred: Failed to connect to ESP32: Timed out… Connecting…“. It means that your ESP32 is not in flashing/uploading mode.
 +
* Press the “Upload” button in the Arduino IDE to upload your sketch
 +
* After you see the  “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button:
 +
 +
[[File:Ardino_ESP32.png]]
  
 
=== MicroPython ===
 
=== MicroPython ===
Line 359: Line 401:
 
* [http://land-boards.com/ESP32-VGA/ESP-32_VGA_Rev1_Schematic.pdf ESP32 VGA Rev 1 Schematic]
 
* [http://land-boards.com/ESP32-VGA/ESP-32_VGA_Rev1_Schematic.pdf ESP32 VGA Rev 1 Schematic]
 
* [http://land-boards.com/ESP32-VGA/ESP32-VGA_Rev2_Schematic.pdf ESP32 VGA Rev 2 Schematic]
 
* [http://land-boards.com/ESP32-VGA/ESP32-VGA_Rev2_Schematic.pdf ESP32 VGA Rev 2 Schematic]
 +
* [http://land-boards.com/ESP32-VGA/ESP32-VGA_Rev3_Schematic.pdf ESP32 VGA Rev 3 Schematic]
 
* [https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf ESP32-WROOM-32 Datasheet]
 
* [https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf ESP32-WROOM-32 Datasheet]
 
* [https://github.com/land-boards/lb-boards/blob/master/ESP32/ESP32-Hub/Parts_/SchematicsforESP32.pdf ESP32 Module schematic]
 
* [https://github.com/land-boards/lb-boards/blob/master/ESP32/ESP32-Hub/Parts_/SchematicsforESP32.pdf ESP32 Module schematic]
 +
 +
== Rev 3 Changes ==
 +
 +
[[File:ESP32-VGA_CAD_REV3.PNG]]
 +
 +
* Adds J5 header to provide power out on FTDI connectors J2, J3
  
 
== Rev 2 Changes ==
 
== Rev 2 Changes ==
Line 366: Line 415:
 
[[File:ESP32-VGA_CAD_REV2-bw.PNG]]
 
[[File:ESP32-VGA_CAD_REV2-bw.PNG]]
  
* Swap FTDI pins 4 and 5 (J2 and J6)
+
* '''Rev 1 board won't program or boot with FDTI #2 card attached'''
 +
** Earlier FabGL had GPIO12 instead of GPIO34
 +
** Move FTDI Rx line (GPIO12 to GPIO34)
 +
* Swap FTDI pins 4 and 5 (FTDI connectors)
 
** Allow direct connect to FTDI card (no swap)
 
** Allow direct connect to FTDI card (no swap)
 
* Add SD Card connector
 
* Add SD Card connector
Line 374: Line 426:
 
** CS  => GPIO 13
 
** CS  => GPIO 13
 
** Remove I/O pins from GVS connector
 
** Remove I/O pins from GVS connector
* Remove 5V FTDI connections
+
* Replace H1/H2 with 1x2 to select/remove DC jack power\
** Replace H2 with 1x3 to select between 2 sources
+
* Remove Polysilicone fuse
*** USB from ESP32 Module
+
* Change ESP32 board name silkscreen
*** 3.3V regulator
+
* Add SD card connector
* Move FDDI Rx line (GPIO12 to GPIO34)
 
* Change ESP32 silkscreen
 
** SD card
 
  
 
== Prototype ==
 
== Prototype ==
Line 397: Line 446:
 
== Assembly Sheet ==
 
== Assembly Sheet ==
  
* [[ESP32-VGA Rev 2 Assembly Sheet]]
+
* [[ESP32-VGA Rev 3 Assembly Sheet]] (Tindie board)
 +
* [[ESP32-VGA Rev 2 Assembly Sheet]] (older Tindie board)
 
* [[ESP-32-VGA Rev 1 Assembly Sheet]]
 
* [[ESP-32-VGA Rev 1 Assembly Sheet]]

Latest revision as of 17:36, 3 September 2022

Tindie-mediums.png

P968-cropped-720pxV.jpg

Features

  • See ESP32-VGA Rev 1 for older rev card
  • ESP32 Module
    • 18 Analog-to-Digital Converter (ADC) channels
    • 10 Capacitive sensing GPIOs
    • 3 UART interfaces
    • 3 SPI interfaces
    • 2 I2C interfaces
    • 16 PWM output channels
    • 2 Digital-to-Analog Converters (DAC)
    • 2 I2S interfaces
  • 6-bit VGA color
    • 2:2:2 R:G:B
  • 2 x PS-2 DIN connectors
    • 5V mouse/keyboard
    • 3.3V to 5V level shifters
      • Better than 5V keyboard with series resistors
    • 10K pull-ups on both sides
  • 2 x FTDI connectors
  • 5V DC Jack
  • 3.3V regulator (optional)
  • GVS pins for extra ESP32 pins
  • 95x95mm form factor
  • 6-32 mounting holes

ESP-32 Module

ESP32 MODULE-720PX.jpg

ESP-32 Module Pinout

ESP32-Pinout.jpg

"Chip" on the module

Esp32-pinout-chip-ESP-WROOM-32.png

ESP32 Pin Usage - Revs 2, 3

ESP-32 VGA Pinout Rev2.PNG

Module Features

  • Architecture: Xtensa Dual-Core 32-bit LX6
  • CPU frequency: up to 240MHz
  • Total RAM available: 528KB (part of it reserved for system)
  • BootROM: 448KB
  • Internal FlashROM: none
  • External FlashROM: code and data, via SPI Flash; usual size 4MB
  • GPIO: 34 (GPIOs are multiplexed with other functions, including external FlashROM, UART, etc.)
  • UART: 3 RX/TX UART (no hardware handshaking), one TX-only UART
  • SPI: 4 SPI interfaces (one used for FlashROM)
  • I2C: 2 I2C (bitbang implementation available on any pins)
  • I2S: 2
  • ADC: 12-bit SAR ADC up to 18 channels
  • DAC: 2 8-bit DACs
  • RMT: 8 channels allowing accurate pulse transmit/receive
  • Programming: using BootROM bootloader from UART - due to external FlashROM and always-available BootROM bootloader, the ESP32 is not brickable

Video DAC LTSpice Simulation

Summing Video Resistor DAC

  • Best values (1%)
    • 422, 845
    • 470, 820 are close/standard values
  • 0.7V into 75 Ohm VGA load
  • 3.3V drive
  • ESP32 has 40 mA drive
    • Uses 8 mA (max)
  • Output in 4 equal voltage steps

VGA Sim 2R Voltage.PNG

Headers

  • The Rev 2 board changes around headers and connectors from the ESP32-VGA Rev 1 board

H1 - 5V

  • The ESP32-VGA can be powered from either the DC Jack or ESP32 USB power
  • Warning: Do not power from 5V Power jack and connect USB cable to the ESP32 module at the same time
    • The ESP32 module has blocking diode to protect the module
      • If the 5V DC jack has a power supply attached with lower voltage it could result in the supplied being shorted between the USB 5V and the DC power jack
      • This is not an issue if the DC power jack is disconnected
  • This could be used for an external power switch

H2/H3 - GVS

  • 3x4 header
  • Ground/Voltage/Signal lines
  1. GPIO35
  2. GPIO12
  3. VN/I39
  4. VP/I36

Connectors

P1 - PS/2 Mouse

  • DIN 6 connector
  • ESP32 pins
  MSEDAT   => GPIO27
  MSECLK   => GPIO26

P2 - PS/2 Keyboard

  • Purple DIN 6 connector
  • ESP32 pins
  KBDAT   => GPIO32
  KBCLK   => GPIO33

P3 - VGA

  • ESP32 pins
  HSync => GPIO23
  VSync => GPIO15
  R0    => GPIO22
  R1    => GPIO21
  G0    => GPIO19
  G1    => GPIO18
  B0    => GPIO5
  B1    => GPIO4

P4 - Audio Out - RCA Jack

  • ESP32 pins
  AUD   => GPIO25

J1 - 5V Power

  • Center +5V

J2 - FTDI #1

  • This interface is in common with the USB-to-Serial interface on the ESP32 module
  • Pinout
  1. GND
  2. RTS (Not used)
  3. 5V (Not used in Rev 2), Connects to J5 on Rev 3
  4. RX (from card to External FTDI)
  5. TX (from External FTDI to card)
  6. CTS (Not used)
  RX    => GPIO3
  TX    => GPIO1

Connect to FTDI card

  • Set FTDI jumper to 3.3V

FTDI rot.jpg

J3 - FTDI #2

  • Most recent (2020-02) ANSI terminal uses pin 34 for Rx
  • Pinout
  1. GND
  2. RTS (Not used)
  3. 5V (Power in if H2 is configured)
  4. RX (from External FTDI to ESP32 card)
  5. TX (from ESP32 card to External FTDI)
  6. CTS (Not used)
  RX2    => GPIO34
  TX2    => GPIO2

Connect to FTDI card

  • Set FTDI jumper to 3.3V (image below shows jumper set to 5V which is wrong)

FTDI rot.jpg

J3 - FTDI #2

  • Most recent (as of 2020-02) ANSI terminal uses pin 34 for Rx
  • Pinout
  1. GND
  2. RTS (Not used)
  3. 5V Connects to J5 on Rev 3
  4. RX (from External FTDI to ESP32 card)
  5. TX (from ESP32 card to External FTDI)
  6. CTS (Not used)
  RX2    => GPIO34
  TX2    => GPIO2

J4 - SD Card

  • Brought to GVS header pins (Rev 1)
  • Brought to SD Card (Rev 2)
  MOSI  => GPIO17
  MISO  => GPIO16
  CLK   => GPIO14
  CS    => GPIO13

J5 - FTDI Power out (Rev 3+ board)

  • Don't install jumpers if an external FTDI interface is used
  • Powers external 3.3 interfaces
    • Useful to power external DTE or DCE RS-232 card
  • Install shunt/jumper at F1PWR to connect FTDI #1 pin J2-2 to +3.3V
  • Install shunt/jumper at F2PWR to connect FTDI #2 pin J3-2 to +3.3V

J5 Rev3.PNG

VGA - Resistor Selection

  • ESP32 has a 3.3V driver which can drive more than 10 mA
  • Ideal case drive current
    • 0.7V (full scale VGA level) into 75 Ohms = 9.33 mA
    • 2/3 of the current or 6.16 mA comes from the lower value resistor (digital most significant bit)
    • 1/3 of the current or 3.08 mA comes from the higher value resistor (digital least significant bit)
  • R-2R values
  • Voltage steps are:

VGA Sim 2R Voltage.PNG

  • Current steps are:

VGA Sim 2R Current.PNG

FabGL GPIOs assignment summary - fabgl dev board rev2

From here

  VGA
    HSync => 23
    VSync => 15
    R0    => 21
    R1    => 22
    G0    => 18
    G1    => 19
    B0    => 4
    B1    => 5

  Audio
    AUD   => 25

  PS/2 - Keyboard
    DAT   => 32
    CLK   => 33

  PS/2 - Mouse
    DAT   => 27
    CLK   => 26

  SDCard - HSPI
    MOSI  => 17 (12 on TTGO/WROVER)
    MISO  => 16 (2 on TTGO, 35 WROVER)
    CLK   => 14
    CS    => 13

  UART - UART1 (USB)
    RX    => 3
    TX    => 1

  UART - UART2
    RX    => 34
    TX    => 2  (not usable on TTGO/WROVER with SDCard active)

I2C (not usable with VGA)

  SDA   => GPIO4  (conflicts with VGA B1)
  SCL   => GPIO15 (conflicts with VGA VSync)

SPI Display - VSPI (not usable with VGA)

  CLK   => GPIO18 (conflicts with VGA G1)
  MISO  => GPIO19 (conflicts with VGA G0)
  MOSI  => GPIO23 (conflicts with VGA HSync)
  CS    => GPIO5  (conflicts with VGA B0)
  D/C   => GPIO22 (conflicts with VGA R0)
  RESET => GPIO21 (conflicts with VGA R1)

Software

FabGL

  • Display Controller features/applications
    • VGA
    • SSD1306
    • PS/2 Mouse and Keyboard Controller
    • Graphics Library
    • Sound Engine
    • Game Engine
    • ANSI/VT Terminal for the ESP32

FabGL Libraries

FabGL Arduino library

Installing the released library

FabGL Library.PNG

Using Latest FabGL builds

  • Fabrizio does a nice job of keeping his Arduino libraries up to date but if you want a bleeding edge experience, you can download his code from GitHub. Note, he's in active development so things often change.

Here's how I did it

  1. Install drivers via Arduino from the Library Manager. These are not the latest files. Space Invaders should run but not have sound (as of now because it's the older version).
  2. Move the FabGL from the Arduino libraries file folder to the desktop.
  3. Copy the FabGL from the GitHub download to the Arduino files folder (where you removed the other folder).
  4. Examples will now be the latest.
  5. Compile/download/test the new files. You know it works if you now get sound from Space Invaders.
  6. Save as where you would normally save your Arduino sketches.

Arduino Programming

  • Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)
  • Board : "DOIT ESP32 DEVKIT V1"
    • Used Board : ESP32 Dev Module with Tools > Partition Scheme > Huge APP option to run VIC-20 (2022-09)
  • DOIT module does not have PSRAM
    • Can't run PC Emulator without PSRAM
  • If you try to upload a new sketch to your ESP32 and you get this error message “A fatal error occurred: Failed to connect to ESP32: Timed out… Connecting…“. It means that your ESP32 is not in flashing/uploading mode.
  • Press the “Upload” button in the Arduino IDE to upload your sketch
  • After you see the “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button:

Ardino ESP32.png

MicroPython

ESP-IDF

Operating Systems

Schematic

Rev 3 Changes

ESP32-VGA CAD REV3.PNG

  • Adds J5 header to provide power out on FTDI connectors J2, J3

Rev 2 Changes

ESP32-VGA CAD REV2-bw.PNG

  • Rev 1 board won't program or boot with FDTI #2 card attached
    • Earlier FabGL had GPIO12 instead of GPIO34
    • Move FTDI Rx line (GPIO12 to GPIO34)
  • Swap FTDI pins 4 and 5 (FTDI connectors)
    • Allow direct connect to FTDI card (no swap)
  • Add SD Card connector
    • MISO => GPIO 16
    • MOSI => GPIO 17
    • CLK => GPIO 14
    • CS => GPIO 13
    • Remove I/O pins from GVS connector
  • Replace H1/H2 with 1x2 to select/remove DC jack power\
  • Remove Polysilicone fuse
  • Change ESP32 board name silkscreen
  • Add SD card connector

Prototype

FabGL P905-512pxV.jpg

Assembly Sheet