1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/vga-cpu/README.txt Fri Nov 02 02:15:09 2018 +0100
1.3 @@ -0,0 +1,118 @@
1.4 +Introduction
1.5 +------------
1.6 +
1.7 +This example demonstrates the generation of an analogue VGA signal from a
1.8 +PIC32 microcontroller using general output pins. Instead of using DMA, which
1.9 +was the focus of the VGAPIC32 project and is a central feature of the
1.10 +approaches demonstrated by other examples (vga, vga-dual, vga-pmp, vga-timer),
1.11 +here the CPU is given the task of transferring pixel data to the output pins.
1.12 +
1.13 +Instead of a timer interrupt condition initiating DMA transfers, the interrupt
1.14 +is handled and a routine invoked to issue the necessary load and store
1.15 +instructions in a loop. Otherwise, the use of the timer to generate sync
1.16 +pulses is as in the other examples and the general display state machine is
1.17 +largely the same.
1.18 +
1.19 +The resulting picture is more pleasing than that produced by most of the DMA
1.20 +examples in that the display pixels have consistent widths. Moreover, the
1.21 +pixels are also narrower than those produced by the vga-timer example. It is
1.22 +possible to generate a display with something approaching 200 pixels
1.23 +horizontally, with 160 pixels being demonstrated.
1.24 +
1.25 +However, the CPU now spends a lot of time occupied in an interrupt request
1.26 +handler generating pixels. This seems less elegant than using DMA, but in
1.27 +practice, the CPU may be effectively stalled where DMA transfers dominate
1.28 +access to the RAM. Even if, in such situations, the CPU may be able to access
1.29 +flash memory to load instructions, programs typically end up accessing RAM at
1.30 +some point, and this would effectively limit the concurrency within the
1.31 +system.
1.32 +
1.33 +One potential advantage of this approach is in the flexibility that might be
1.34 +achieved by manipulating the pixel data. With DMA, data is transferred as it
1.35 +is found and is generally not transformed (although there are some features in
1.36 +the PIC32 DMA controller for certain kinds of data), whereas we might envisage
1.37 +supporting display modes employing fewer bits for the output signal, reducing
1.38 +the number of colours but also the size of the framebuffer.
1.39 +
1.40 +Hardware Details
1.41 +================
1.42 +
1.43 +The pin usage of this solution is documented below.
1.44 +
1.45 +PIC32MX270F256B-50I/SP Pin Assignments
1.46 +--------------------------------------
1.47 +
1.48 +MCLR# 1 \/ 28
1.49 +HSYNC/OC1/RA0 2 27
1.50 +VSYNC/OC2/RA1 3 26 RB15/U1TX
1.51 + D0/RB0 4 25 RB14
1.52 + D1/RB1 5 24 RB13/U1RX
1.53 + D2/RB2 6 23
1.54 + D3/RB3 7 22 RB11/PGEC2
1.55 + 8 21 RB10/PGEC3
1.56 + RA2 9 20
1.57 + RA3 10 19
1.58 + D4/RB4 11 18 RB9
1.59 + 12 17 RB8
1.60 + 13 16 RB7/D7
1.61 + D5/RB5 14 15
1.62 +
1.63 +Note that RB6 is not available on pin 15 on this device (it is needed for VBUS
1.64 +unlike the MX170 variant).
1.65 +
1.66 +UART Connections
1.67 +----------------
1.68 +
1.69 +UART1 is exposed by the RB13 and RB15 pins.
1.70 +
1.71 +Data Signal Routing
1.72 +-------------------
1.73 +
1.74 +For one bit of intensity, two bits per colour channel:
1.75 +
1.76 +D7 -> 2200R -> I
1.77 +
1.78 +I -> diode -> R
1.79 +I -> diode -> G
1.80 +I -> diode -> B
1.81 +
1.82 +D6 (not connected)
1.83 +
1.84 +D5 -> 470R -> R
1.85 +D4 -> 1000R -> R
1.86 +D3 -> 470R -> G
1.87 +D2 -> 1000R -> G
1.88 +D1 -> 470R -> B
1.89 +D0 -> 1000R -> B
1.90 +
1.91 +HSYNC -> HS
1.92 +VSYNC -> VS
1.93 +
1.94 +Output Socket Pinout
1.95 +--------------------
1.96 +
1.97 + 5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R)
1.98 +
1.99 + 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND)
1.100 +
1.101 + 15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC)
1.102 +
1.103 +Output Cable Pinout
1.104 +-------------------
1.105 +
1.106 + 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND)
1.107 +
1.108 + 6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND)
1.109 +
1.110 + 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC)
1.111 +
1.112 +References
1.113 +----------
1.114 +
1.115 +https://en.wikipedia.org/wiki/VGA_connector
1.116 +
1.117 +http://papilio.cc/index.php?n=Papilio.VGAWing
1.118 +
1.119 +http://lucidscience.com/pro-vga%20video%20generator-2.aspx
1.120 +
1.121 +https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga