PicoVGA01

From Land Boards Wiki
Jump to navigation Jump to search

Tindie-mediums.png

PicoVGA01 P1080468-720px.jpg

PicoVGA

PicoVGA uses a Raspberry Pi Pico to drive a VGA/TV display. PicoVGA was designed by Miroslav Nemecek.

The RP2040 processor contains 264 KB of RAM. This is not much for higher resolution image output and therefore RAM needs to be very sparing. In technical practice and for retro games (the processor does not have the power for more advanced games), 8-bit graphics output in R3G3B2 format (i.e. red 3 bits, green 3 bits and blue 2 bits) is fully sufficient. Output in 16 or 24 bits is not meaningful in normal practice, as the Raspberry Pico does not have enough memory or power to provide such large amounts of data in areas other than short demos. Using the dithering technique, interesting display results can be achieved even with 8-bit output.

PicoVGA diagram.jpg

Features

  • Raspberry Pi Pico
    • Automatic overclocking of processor
    • Library uses the 2nd core, main program uses 1st core
  • VGA
    • 8-bit output in R:G:B 3:3:2 format (256 colors)
    • VGA progressive output up to 1280x960 resolution
    • Automatic configuration video mode timings
    • Composite sync
    • Video formats
      • 1 base layer and 3 overlay layers with transparency
      • 30 frame buffer formats: graphics, tiles, text, special
      • Colour palettes
      • Screen split into segments of different formats
      • RLE compression
      • Transparency with selectable key colour
      • Hardware sprites
      • Output layers to different color bits (color planes)
  • PWM mono audio output
    • 3.5mm stereo jack
  • Joystick connector(s)
    • JOYPAD or
    • 9-pin "Atari" Joystick
  • 99.5x69.5mm card
  • (4) 4-40 mounting holes
  • Hackaday page

Connectors

J1/J3 Pico Breakout Headers

  • 2 of 1x20 headers

PicoVGA1 J1 J3.PNG

Pico Pin Use

  • 8 spare pins
  • JOYPAD has more buttons than Atari Joystick (8 vs 5)
Pico Pin Pico Signal PicoMite Pico Pin Pico Signal PicoMite DB-9 JOYSTICK
1 GP0 BLU_LO 40 VBUS USB_PWR
2 GP1 BLU_HI 39 VSYS 5V
3 GND GND 38 GND GND
4 GP2 GRN_LO 37 VEN3 VEN3
5 GP3 GRN_MID 36 V3OUT +3.3V J6-7 NOT USED
6 GP4 GRN_HI 35 ADCREF ADCREF
7 GP5 RED_LO 34 GP28 SPARE
8 GND GND 33 GND GND
9 GP6 RED_MID 32 GP27 JOYPAD_UP
10 GP7 RED_HI 31 GP26 JOYPAD_UPPER_RIGHT J6-5 PADDLEB
11 GP8 CSYNC 30 RUN RUN
12 GP9 SPARE 29 GP22 JOYPAD_DOWN J6-9 PADDLEA
13 GND GND 28 GND GND
14 GP10 SPARE 27 GP21 JOYPAD_CENTER_FIRE J6-4 RIGHT
15 GP11 SPARE 26 GP20 JOYPAD_LEFT J6-3 LEFT
16 GP12 SPARE 25 AUDIO AUDIO_MONO
17 GP13 SPARE 24 GP18 JOYPAD_FIRE J6-2 DOWN
18 GND GND 23 GND GND J6-8 GND
19 GP14 SPARE 22 GP17 JOYPAD_RIGHT J6-6 FIRE
20 GP15 SPARE 21 GP16 JOYPAD_UPPER_LEFT J6-1 UP

J2 - Mono Audio

  • 3.5mm stereo jack
  • Use with external amplified speakers
  • Mono signal on both speakers

PicoVGA1 Audio J2.PNG

J4 - 5V USB B

  • Power the card in an enclosure
  • 5V power
  • Full-size USB B
  • No USB signals

PicoVGA1 DC J4.PNG

J5 - JOYPAD

P1826-CROPPED-720PX.jpg

  • Land Boards JOYPAD card
  • Optional 1x12 Header matches pinout of JOYPAD card
    • 8 switches
      • Up, Down, Left, Right, Fire, Center Fire, Upper Left, Upper Right
  • JOYPAD card can be built without pull-up resistors
  • 1:1 cable between PicoVGA01 and JOYPAD cards
    • Can use 10 pin Dupont housings (don't need VCC connections)

RasPiPico VGA J5 JOYPAD.PNG

// Init the JoyPad pins
// #define PB_UL 16		// Upper Left pushbutton
// #define PB_RT 17		// Right direction
// #define PB_FR 18		// Fire
// #define PB_LT 20		// Left direction
// #define PB_CF 21		// Center Fire
// #define PB_DN 22		// Down direction
// #define PB_UR 26		// Upper right
// #define PB_UP 27		// Up direction

J6 - Joystick (DB-9)

RasPiPico VGA J6 JOYSTICK.PNG


// Atari Joystick DB-9 pushbutton to Pico pin mapping
#define PB_UP 16		// Up direction
#define PB_DN 18		// Down direction
#define PB_LT 20		// Left direction
#define PB_RT 21		// Right direction
#define PB_FR 17		// Fire

Rev 1 JOYPAD configured as Atari Joystick with DB-9

PicoVGA JOYPAD P18499-720px.jpg

Rev 2 JOYPAD configured as Atari Joystick with DB-9

PicoVGA01 JOYPAD-Rev2 P18581-720px.jpg

Atari Joystick

  • Tested/works
  • Atari Joystick pinout

Atari joystick pinout.png

Amazon Atari Joystick.PNG

MSX Joystick

  • Incompatible?

MSX Joystick Schematic Circuit 382px.png


  1. UP
  2. DOWN
  3. LEFT
  4. RIGHT
  5. +VCC
  6. BUTTON I
  7. BUTTON II
  8. BUTTON COMMON
  9. GND

J7 - 3.3V

  • 1x2 header
  • Additional power pins for external use

PicoVGA1 3V J7.PNG

P1 - VGA

  • Standard HD15 connector
  • 8-bit output in R:G:B 3:3:2 format (256 colors)

Schematic

Connector Views

  • Joystick/power

PicoVGA01 P1080474-720px.jpg

  • VGA/audio

PicoVGA01 P1080475-720px.jpg

Factory Acceptance Test

Test Setup

  • Unit Under Test (UUT)
  • JOYPAD with 9 pin M-F cable
  • VGA Monitor
  • Stereo speakers

PicoVGA JOYPAD P18499-720px.jpg

Test Procedure

  • Apply 5V power to UUT via USB B connector on UUT
  • Demo will play
    • Verify colors, R, B, Cyan, Yellow, White
    • Play game from JOYPAD moving LEFT, RIGHT, UP, DOWN buttons
    • Verify pause via FIRE button
  • Mark TEST block on UUT PCB rear when completed

Enclosure

  • 99.5mmx69.5mm outline
    • Board is designed to fit into Aluminum Project Box Enclosure DIY 100*76*35mm - ebay search
    • VGA, 3.5mm Audio on one end
    • USB B (Power), JoyStick DB-9 on the opposite end

PicoVGA01 Mechanicals

PicoVGA01 Mechs.PNG

Prototype Build Hardware

PicoVGA P1080432-720px.jpg

Raspberry Pi Pico Breakout Card

RasPiPico.PNG

VGA Adapter Card

VGAX49 P901-cropped-720px.jpg

RasPiPico VGA J1.PNG

RasPiPico VGA Wiring.PNG

Audio Filter Card

RasPiPico AUDIO Wiring.PNG

JoyPad

P1826-CROPPED-720PX.jpg

Prototype Build Wiring

Pico Pin GPIO Signal Name Color Dest Pin
1 GP0 B3 BLU VGAX49 13
2 GP1 B4 BLU VGAX49 12
3 GND GND BRN VGAX49 20
4 GP2 G3 GRN VGAX49 8
5 GP3 G4 GRN VGAX49 7
6 GP4 G5 GRN VGAX49 6
7 GP5 R2 RED VGAX49 3
9 GP6 R3 RED VGAX49 2
10 GP7 R4 RED VGAX49 1
11 GP8 CSYNC GRY VGAX49 17
21 GP16 BRN JOYPAD 10
22 GP17 ORG JOYPAD 9
23 GND GND GRN AUD-FILT 2
24 GP18 YEL JOYPAD 8
25 GP19 AUDIO GRY AUD-FILT 1 or 3
26 GP20 GRN JOYPAD 7
27 GP21 BLU JOYPAD 6
28 GND GND BLK JOYPAD 11
29 GP22 VIO JOYPAD 5
31 GP26 GRY JOYPAD 4
32 GP27 WHT JOYPAD 3

Software

The PicoVGA library is written in C/C++ and allows output from the Raspberry Pico to a VGA monitor or PAL/NTSC TV, with a focus on ease of use in technical and gaming applications. It provides 4 graphic overlay layers with transparency, nearly 30 frame buffer formats that can be freely combined with each other, making do with limited RAM memory size. The limitation of output to 8 bits also contributes to RAM saving.

Download UF2

  • Remove power (both USB B and USB Micro cable)
  • Hold down boot button while plugging in USB Micro cable
  • Release boot button
  • Pico drive will appear on computer
  • Drag/drop the .uf2 file to the drive
  • Card will reboot and run downloaded code

Build Template

   text    data     bss     dec     hex filename
  12192      28     980   13200    3390 build/program.elf

PicoVGA examples

Ants - card game
       keyboard control: 'J' left, 'L' right, space select, 'D' discard, 'H' help, 'Q' quit

AntsJP - card game
         JoyPad control: left, right, centerFire=select, upperLeft=discard, Fire=help move, upperRight=quit
	
AntsJS - card game
         JoyStick control: left, right, Up=select, down=discard, 'H'=help move, Fire=quit

Balloons - sprite demo, floating balloons

Draw - draw graphics demo

Earth - rotating Earth globe

Eggs - game of Eggs+Chickens+Hens, variant of the Reversi game
       keyboard control: 'L' right, 'I' up, 'J' left, 'K' down, 'H' help, 'Q' quit, 'P' 2 players, 'D' demo, space stone, Enter ok

EggsJP - game of Eggs+Chickens+Hens, variant of the Reversi game
         JoyPad control: right, up, left, down, fire=help, upperRight=quit, centerFire=stone, upperLeft=ok
         keyboard control: 'P' 2 players, 'D' demo

EggsJS - game of Eggs+Chickens+Hens, variant of the Reversi game
         JoyStick control: right, up, left, down, Fire=stone
         keyboard control: 'H'=help, Enter=ok, 'Q'=quit, 'P' 2 players, 'D' demo

Fifteen - game
          keyboard control: 'L' right, 'I' up, 'J' left, 'K' down, 'Q' new game

FifteenJP - game
            JoyPad control: right, up, left, down, upperRight=new game

FifteenJS - game
            JoyStick control: right, up, left, down, Fire=new game

Flag - animation of flag fluttering in the wind

Ghost Racing - car racing game, racing with player's ghost copy, demonstration of 3D perspective projection
               keyboard control: 'I' gear up, 'K' gear down, 'J' turn left, 'L' turn right

Ghost RacingJP - car racing game, racing with player's ghost copy, demonstration of 3D perspective projection
                 JoyPad control: up=shift gear up, down=shift gear down, left=turn left, right=turn right

Ghost RacingJS - car racing game, racing with player's ghost copy, demonstration of 3D perspective projection
                 JoyStick control: up=shift gear up, down=shift gear down, left=turn left, right=turn right

Ginger House - picture fairy tale book
               keyboard control: 'J' previous page, 'L' next page

Ginger HouseJP - picture fairy tale book
                 JoyPad control: left=previous page, right=next page

Ginger HouseJS - picture fairy tale book
                 JoyStick control: left=previous page, right=next page

Hello - simple demonstration, print text "Hello world!" on the screen

Hypno - hypnotizing rotating pattern

Level Meter - demo of music volume level indication

Life - game, reproducing cells
       keyboard control: 'L' right, 'I' up, 'J' left, 'K' down, 'C' copy, 'V' paste, 'D' clear,
       space flip state, Enter run life, 0..9 select slot

LifeJP - game, reproducing cells
         JoyPad control: right=right, up=up, left=left, dowb=down, upperLeft=copy, Fire=paste, centerFire=flip state, 
         UpperRight=run life
	 keyboard control: 'D' clear, 0..9 select slot

LifeJS - game, reproducing cells
         JoyStick control: right=right, up=up, left=left, dowb=down, Fire=flip state, 
         keyboard control: 'D' clear, 0..9 select slot, 'C'=copy, 'V'=paste, Enter=run life

Lines - moving line patterns

Mandelbrot - fractal pattern generator
             keyboard control: 'E' up, 'S' left, 'D' right, 'X' down, 'Q' zoom in, 'A' zoom out,
             'L' low resolution 132x100, 'M' medium resolution 264x200, 'H' high resolution 528x400,
             'I' integer arithmetics, 'F' float arithmetics, 'B' double arithmetics,
             'O' decrease number of steps, 'P' increase number of steps, 'U' increase system clock,
             'T' decrease system clock, space redraw

MandelbrotJP - fractal pattern generator
               JoyPad control: Up, left, right, down, Fire zoom in, upper left zoom out,
               keyboard control: 'L' low resolution 132x100, 'M' medium resolution 264x200, 'H' high resolution 528x400,
              'I' integer arithmetics, 'F' float arithmetics, 'B' double arithmetics,
              'O' decrease number of steps, 'P' increase number of steps, 'U' increase system clock,
              'T' decrease system clock, space redraw

MandelbrotJS - fractal pattern generator
               JoyStick control: Up, left, right, down, Fire zoom in 
               keyboard control: 'A' zoom out,
               'L' low resolution 132x100, 'M' medium resolution 264x200, 'H' high resolution 528x400,
               'I' integer arithmetics, 'F' float arithmetics, 'B' double arithmetics,
               'O' decrease number of steps, 'P' increase number of steps, 'U' increase system clock,
               'T' decrease system clock, space redraw

Matrix Rain - simulation of Matrix code rain

Maze - game, simple maze with maze generator
       keyboard control: 'J' left, 'I' up, 'L' right, 'K' down, 'H' help (show door)

MazeJP - game, simple maze with maze generator
         JoyPad control: left, up, right, down, upperRight=help (show door)

MazeJS - game, simple maze with maze generator
         JoyStick control: left, up, right, down, Fire=help (show door)

Monoscope - test of various graphic modes
            keyboard control: '0'..'9', 'A'..'U' select videomode

Oscilloscope - demo oscilloscope simulator

Pacman - game of popular Pac-man
         keyboard control: 'J' left, 'I' up, 'L' right, 'K' down, 'A' pause

PacmanJP - game of popular Pac-man
           JoyPad control: left, up, right, down, upper right pause

PacmanJS - game of popular Pac-man
           JoyStick control: left, up, right, down, Fire=pause

Pi - calculate Pi at 4800 digits

Pixels - random pixels

Raytrace - ray tracing 3D demonstration of mirror spheres

Sokoban - game with 3000 puzzles and with their solutions
          keyboard control: 'L' right, 'I' up, 'J' left, 'K' down, 'H' help (solution),
          'R' restart scene, 'Q' previous level, 'W' next level, 'P' info

SokobanJP - game with 3000 puzzles and with their solutions
            JoyPad control: right, up, left, down, upperLeft=previous level, fire=next level, uppperRight=restart scene, 
            keyboard 'H' help (solution), 'P' info

SokobanJS - game with 3000 puzzles and with their solutions
            JoyStick control: right, up, left, down, Fire=restart scene, 
            'Q' previous level, 'W' next level, 'P' info
            keyboard 'H' help (solution), 'P' info

Spheres - draw random spheres

Spots - draw random dot spots

Tetris - game
         keyboard control: 'L' right, 'I' turn, 'J' left, 'K' drop, 'A' pause

TetrisJP - game
           JoyPad control: right, center fire turn, left, down = drop, upper right = pause

TetrisJS - game
           JoyStick control: right, up turn, left, down = drop, Fire = pause

Train - puzzle game with 50 levels and with their solutions
        keyboard control: 'L' right, 'I' up, 'J' left, 'K' down, 'H' help (solution), Enter OK, Esc escape, BS backspace

TrainJP - puzzle game with 50 levels and with their solutions
          JoyPad control: right, up, left, down, centerFire=OK, upperLeft=escape, fire=backspace, upperRight=help (solution), 

TrainJS - puzzle game with 50 levels and with their solutions
          JoyStick control: right, up, left, down, Fire=OK, 
          Esc=escape, BS=backspace, 'H'=help (solution), 

Twister - deformable block covered with 4 textures

Water surface - simulation of a rippling water surface

Assembly Sheet