ESP32-VGA Rev 1

From Land Boards Wiki
Jump to navigation Jump to search

Tindie-mediums.png

P968-cropped-720pxV.jpg

Features

  • ESP32-VGA - Newer rev cards
  • 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 - Rev 1

ESP-32 VGA Pinout.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 (Rev 1 board)

H1 - 3.3V SRC select

H1 3p3V Select.png

  • 1-2 = Get 3.3V from ESP32 on-board regulator
  • 2-3 = Get 3.3V from on-board regulator (Default)

H2 - 5V SRC Select Jumper (Rev 1 Board)

  • 5V power options for the 5V to 3.3V regulator

H2 5V Select.png

  • 2x4 header
  • Care must be taken to install the correct jumpers
  • USB jumper sends out 5V when a USB cable is connected to the ESP32 module

Power from DC Jack

  • Do not connect USB cable when the DC jack is used
  • 1-2 = VUSB - Install - Power to ESP32
  • 3-4 = DCIN - Install - Power comes from DC jack
  • 5-6 = FTDI5V_1 - Do not install
  • 7-8 = FTDI5V_2 - Do not install

Power from USB on ESP32 module

  • 1-2 = VUSB - Install - 5V comes from USB on ESP32 module
  • 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)

  • Do not use this position with "most" FTDI cards since they will drive 5V on the Rx/Tx pins when the FTDI jumper is set to 5V

Power from FTDI #2

  • Do not use this position with "most" FTDI cards since they will drive 5V on the Rx/Tx pins when the FTDI jumper is set to 5V

Connectors (Rev 1 board)

P2/P4 = GVS - Rev 1

  • Ground/Voltage/Signal lines
  1. GPIO13
  2. GPIO14
  3. GPIO16
  4. GPIO17
  5. GPIO35
  6. GPIO34
  7. VN
  8. VP

P3 - VGA - Rev 1

  • ESP32 pins
  • This table is incorrect - it has the Lower/Higher bits swapped
  HSync => GPIO23
  VSync => GPIO15
  R0    => GPIO22
  R1    => GPIO21
  G0    => GPIO19
  G1    => GPIO18
  B0    => GPIO5
  B1    => GPIO4

J2 - FTDI #1 - Rev 1

  1. GND
  2. RTS (Not used)
  3. 5V (Power in if H2 is configured)
  4. RX (from card to External FTDI)
  5. TX (from External FTDI to card)
  6. CTS (Not used)

Connect to FTDI card - Rev 1

  • Set FTDI jumper to 3.3V (unlike picture below)
  • Cross-over pins 4 and 5 when connecting to FTDI card (Rev 1 only)

FTDI rot.jpg

J6 - FTDI #2 - Rev 1

  • Rev 1 board won't program or boot with FDTI #2 card attached
  • This interface is in common with the USB-to-Serial interface on the ESP32 module
  1. GND
  2. RTS (Not used)
  3. 5V (Power in if H2 is configured)
  4. TX2 (from card to External FTDI)
  5. RX2 (from External FTDI to card)
  6. CTS (Not used)
  • Requires a cross-over of the Transmit and Receive pins if directly connecting to an FTDI part
  • Earlier versions of the FabGL schematics used pin 12 for RX
  • Most recent (2020-02) ANSI terminal uses pin 34
  • Board won't boot with an FTDI interface attached and USB cable attached
    • This is an issue for the ANSI Terminal sketch
  • Original pins were (Rev 1 matches original)
  RX2    => 12
  TX2    => 2

Here's why using pin 12 is a bad idea:

GPIO12 (MTDI) is used as a bootstrapping pin to select output voltage of an internal regulator which powers the flash chip (VDD_SDIO). This pin has an internal pulldown so if left unconnected it will read low at reset (selecting default 3.3V operation).

UART2 Rework

  • The easiest way to do this is to wire the FTDI to GPIO34 pin instead of pin J6-5
    • Not pretty, but it does work fine
  • This is what is needed to permanently rework the board
  • Rework is only needed to run "stock" FabGL code that uses the UART2 port on the ESP32 (like the ansi terminal)
  • Cut trace/adding jumper to rev 1 board
    • Route to GPIO34
  • Cut as follows (cut in white)

GPIO12 Cut.PNG

  • Add wire as follows (add wire in white)

GPIO34 Add.PNG

  • [2020-01-20] Tested rework on card and it worked

Connect to FTDI card - Rev 1

  • Set FTDI jumper to 3.3V
  • Cross-over pins 4 and 5 when connecting to FTDI card (Rev 1 only)

FTDI rot.jpg

J3 - PS/2 Keyboard - Rev 1

  • Purple DIN 6 connector
  • ESP32 pins
  DAT   => 32
  CLK   => 33

J4 - PS/2 Mouse - Rev 1

  • DIN 6 connector
  • ESP32 pins
  DAT   => 27
  CLK   => 26

J5 - Audio Out - RCA Jack - Rev 1

  • ESP32 pins
  AUD   => 25

J15 - 5mm Terminal Block - Rev 1

  • 5V
  • Gnd

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
  • 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