Video

Video is generated by the BIOS, through the PIO0 peripheral of the RP2040. Two of its state machines (SM0 and SM1) are used to generate a VGA signal:

  • SM0 - "Timing Program" - generates HSYNC and VSYNC signals
  • SM1 - "Pixel Program" - generates the actual 16-bit RGB pixels (in pairs)

The two state machines are synchronized through the IRQ0 line. Data is carried from the timing and pixel buffers to the PIO0 timing and pixel FIFOs using DMA channels 0 and 1 respectively.

                                                     ┌─┬────┐
                                               ┌────►│H│  0 │
                                               │     ├─┼────┤
                                               ├────►│V│  1 │
                                               │     ├─┼────┤
┌────────────────────────┐                     │     │ │  2 │
│                        │                     │     │ ├────┤
│   ┌────────────────┐   │                     │     │ │  3 │
│   │                │   │                     │  ┌─►│R├────┤
│   │                │   │       ┌───────────┐ │  │  │ │  4 │
│   │     Timing     │   │       │           │ │  │  │ ├────┤
│   │     Buffer     │   │DMA CH0│ ┌──┬────┐ │ │  │  │ │  5 │
│   │                ├───┼───────┼─► F│ SM0├─┼─┘  │  ├─┼────┤
│   └────────────────┘   │       │ └──┴─┬──┘ │    │  │ │  6 │
│                        │       │  IRQ0│    │    │  │ ├────┤
│   ┌────────────────┐   │DMA CH1│ ┌──┬─▼──┐ │    │  │ │  7 │
│   │                ├───┼───────┼─► F│ SM1├─┼────┼─►│G├────┤
│   │                │   │       │ └──┴────┘ │    │  │ │  8 │
│   │     Pixel      │   │       │           │    │  │ ├────┤
│   │     Buffer     │   │       └───────────┘    │  │ │  9 │
│   │                │   │            PIO0        │  ├─┼────┤
│   └────────────────┘   │                        │  │ │ 10 │
│                        │                        │  │ ├────┤
│                        │                        │  │ │ 11 │
└────────────────────────┘                        └─►│B├────┤
           RAM                                       │ │ 12 │
                                                     │ ├────┤
                                                     │ │ 13 │
                                                     └─┴────┘

Hardware

┌───────────────────────────────────────────────────────────────┐
│                          RP2040 GPIO                          │
├─────┬─────┬───┬───┬───┬───┬───┬───┬───┬───┬────┬────┬────┬────┤
│  0  │  1  │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │
├─────┼─────┼───┴───┴───┴───┼───┴───┴───┴───┼────┴────┴────┴────┤
│ Hs  │ Vs  │      RED      │     GREEN     │       BLUE        │
└─────┴─────┴───────────────┴───────────────┴───────────────────┘

The first 14 GPIO pins of the RP2040 are dedicated to generating the VGA signal. The 4-bits of each color are fed through an R-2R resistor ladder DAC. The analog signals are then fed through a video buffer (THS7316 or equivalent). The I2C bus of the BMC is also connected to the DDC pins of the VGA port and may be used in the future for display identification purposes.

Physical connection to the screen is done through a TPD7S019 ESD protection circuit and a female DE-15 connector.

Supported video modes:

The following video modes are supported:

  • Mode 0x00 - 80x30 text mode at 640x480
  • Mode 0x01 - 80x60 text mode at 640x480
  • Mode 0x10 - 80x25 text mode at 640x400
  • Mode 0x11 - 80x50 text mode at 640x400
  • Mode 0x91 - 80x25 text mode at 640x200
  • Mode 0x05 - 640x480 in 16 colours
  • Mode 0x06 - 640x480 in 4 colours
  • Mode 0x07 - 640x480 in 2 colours
  • Mode 0x15 - 640x400 in 16 colours
  • Mode 0x16 - 640x400 in 4 colours
  • Mode 0x17 - 640x400 in 2 colours
  • Mode 0x94 - 640x200 in 256 colours
  • Mode 0x95 - 640x200 in 16 colours
  • Mode 0x96 - 640x200 in 4 colours
  • Mode 0x97 - 640x200 in 2 colours
  • Mode 0x8C - 320x240 in 256 colours
  • Mode 0x8D - 320x240 in 16 colours
  • Mode 0x8E - 320x240 in 4 colours
  • Mode 0x8F - 320x240 in 2 colours
  • Mode 0x9C - 320x200 in 256 colours
  • Mode 0x9D - 320x200 in 16 colours
  • Mode 0x9E - 320x200 in 4 colours
  • Mode 0x9F - 320x200 in 2 colours