# HG changeset patch # User Paul Boddie # Date 1558388068 -7200 # Node ID a7af613384c71ee16d5c9bd858635c255b79e4e3 # Parent d112c32b7417dd805f91e3e00ffcc6ea49cace24 Expanded the documentation of examples, covering the demo example and the common resources employed by all examples. Consolidated common details of the VGA examples into a signal wiring page. diff -r d112c32b7417 -r a7af613384c7 docs/wiki/CommonPIC32 --- a/docs/wiki/CommonPIC32 Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/CommonPIC32 Mon May 20 23:34:28 2019 +0200 @@ -6,5 +6,5 @@ == Documentation == - * [[VGA Output Examples]] + * [[Examples]] * [[VGA Signal Output]] diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/Examples Mon May 20 23:34:28 2019 +0200 @@ -0,0 +1,64 @@ += Examples = + +To investigate various kinds of applications and to demonstrate techniques +discovered and employed, a collection of examples has been provided: + + * [[/demo|Demo]] + * [[VGA Output Examples]] + +== Common Example Characteristics == + +Each example provides the following resources: + + `devconfig.h`:: device configuration details + `Makefile`:: a build configuration for the example + `main.c`:: the example main program + `main.h`:: definitions for the main program + +=== Device Configuration === + +The `devconfig.h` file is intended to provide configuration settings related +to the device configuration and oscillator (clock) frequency. The following +definitions are employed: + + `DEVCFG1_CONFIG`:: the value with which the `DEVCFG1` register will be + programmed, this typically being constructed using symbols + defining values for various register fields + + `DEVCFG2_CONFIG`:: the value with which the `DEVCFG2` register will be + programmed + + `FPB`:: the peripheral clock frequency, whose value will be a consequence of + the above register settings + +=== Build Configuration === + +The `Makefile` is concerned with defining source and program (target) files, +build artefacts, configuration flags, employing the common definitions and +rules found in the `mk` directory located at the top level of the CommonPIC32 +distribution. + +=== Main Program === + +The `main.c` and `main.h` files are concerned with providing a `main` function +with the following signature: + +{{{ +void main(void); +}}} + +Since the `mk/common.mk` definitions file used by the build configuration +provides access to various library files, the first tasks performed by the +`main` function are likely to involve initialisation using various +`init_`-prefixed functions. + +Other necessary functions are those handling exceptions and interrupts, having +the following signatures: + +{{{ +void exception_handler(void); +void interrupt_handler(void); +}}} + +These functions are called by the low-level library functionality when CPU +exceptions and interrupts occur. diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--demo --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/Examples--demo Mon May 20 23:34:28 2019 +0200 @@ -0,0 +1,57 @@ += Demo Example = + +This example demonstrates UART communication using UART1. Interrupt conditions +on the UART peripheral are handled, input is tested, output is produced, and +upon receiving the `0` character, DMA-driven output is initiated. + +The DMA-driven output demonstrates mechanisms employed by some of the [[VGA +Output Examples|VGA examples]]. A channel is enabled by the interrupt handler +and its transfers each initiated by a timer; this should cause text to be +transmitted relatively slowly across the serial connection... + +{{{ +Hello! +}}} + +When this first channel completes all transfers, two other channels chained to +it are enabled. Another timer then causes their transfers to be initiated. +Since these two channels effectively compete for access to the UART +peripheral, their transfers are interleaved. Regardless of the configuration +of the example, more text should be transmitted relatively slowly... + +{{{ +And once again, hello! +}}} + +Although such DMA channel interleaving is rather exotic, other techniques +employed by the example are likely to be applicable elsewhere. + +== Hardware Details == + +The pin usage of this solution is documented below. + +=== PIC32MX270F256B-50I/SP Pin Assignments === + +{{{ +MCLR# 1 \/ 28 + RA0 2 27 + RA1 3 26 RB15/U1TX + RB0 4 25 RB14 + RB1 5 24 RB13/U1RX + RB2 6 23 + RB3 7 22 RB11/PGEC2 + 8 21 RB10/PGEC3 + RA2 9 20 + RA3 10 19 + RB4 11 18 RB9 + 12 17 RB8 + 13 16 RB7 + RB5 14 15 +}}} + +Note that RB6 is not available on pin 15 on this device (it is needed for VBUS +unlike the MX170 variant). + +=== UART Connections === + +UART1 is exposed by the RB13 and RB15 pins. diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--vga --- a/docs/wiki/Examples--vga Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/Examples--vga Mon May 20 23:34:28 2019 +0200 @@ -1,8 +1,9 @@ = VGA Output Example = -This example demonstrates the generation of an analogue VGA signal from a -PIC32 microcontroller using general output pins. It follows on from the work -done in the VGAPIC32 project. The result is not entirely satisfactory: +This example demonstrates the generation of an analogue [[VGA Signal Output| +VGA]] signal from a PIC32 microcontroller using general output pins. It +follows on from the work done in the VGAPIC32 project. The result is not +entirely satisfactory: * Every fourth pixel is wider than the others, this apparently being an artefact of the DMA transfer mechanism. @@ -68,33 +69,3 @@ HSYNC -> HS VSYNC -> VS }}} - -=== Output Socket Pinout === - -{{{ -5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) - - 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) - -15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) -}}} - -=== Output Cable Pinout === - -{{{ - 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) - -6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) - - 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) -}}} - -== References == - -https://en.wikipedia.org/wiki/VGA_connector - -http://papilio.cc/index.php?n=Papilio.VGAWing - -http://lucidscience.com/pro-vga%20video%20generator-2.aspx - -https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--vga-cpu --- a/docs/wiki/Examples--vga-cpu Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/Examples--vga-cpu Mon May 20 23:34:28 2019 +0200 @@ -1,9 +1,9 @@ = VGA Output Example (CPU-Driven Transfers) = -This example demonstrates the generation of an analogue VGA signal from a -PIC32 microcontroller using general output pins. Instead of using DMA, which -was the focus of the VGAPIC32 project and is a central feature of the -approaches demonstrated by other examples ([[../vga|vga]], +This example demonstrates the generation of an analogue [[VGA Signal Output| +VGA]] signal from a PIC32 microcontroller using general output pins. Instead +of using DMA, which was the focus of the VGAPIC32 project and is a central +feature of the approaches demonstrated by other examples ([[../vga|vga]], [[../vga-dual|vga-dual]], [[../vga-pmp|vga-pmp]], [[../vga-timer|vga-timer]]), here the CPU is given the task of transferring pixel data to the output pins. @@ -88,33 +88,3 @@ HSYNC -> HS VSYNC -> VS }}} - -=== Output Socket Pinout === - -{{{ -5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) - - 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) - -15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) -}}} - -=== Output Cable Pinout === - -{{{ - 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) - -6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) - - 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) -}}} - -== References == - -https://en.wikipedia.org/wiki/VGA_connector - -http://papilio.cc/index.php?n=Papilio.VGAWing - -http://lucidscience.com/pro-vga%20video%20generator-2.aspx - -https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--vga-dual --- a/docs/wiki/Examples--vga-dual Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/Examples--vga-dual Mon May 20 23:34:28 2019 +0200 @@ -1,8 +1,9 @@ = VGA Output Example (Dual-Channel DMA Transfers) = -This example demonstrates the generation of an analogue VGA signal from a -PIC32 microcontroller using general output pins. It follows on from the work -done in the VGAPIC32 project. The result is not entirely satisfactory: +This example demonstrates the generation of an analogue [[VGA Signal Output| +VGA]] signal from a PIC32 microcontroller using general output pins. It +follows on from the work done in the VGAPIC32 project. The result is not +entirely satisfactory: * Every fourth pixel is wider than the others, this apparently being an artefact of the DMA transfer mechanism. @@ -77,33 +78,3 @@ HSYNC -> HS VSYNC -> VS }}} - -=== Output Socket Pinout === - -{{{ -5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) - - 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) - -15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) -}}} - -=== Output Cable Pinout === - -{{{ - 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) - -6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) - - 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) -}}} - -== References == - -https://en.wikipedia.org/wiki/VGA_connector - -http://papilio.cc/index.php?n=Papilio.VGAWing - -http://lucidscience.com/pro-vga%20video%20generator-2.aspx - -https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--vga-pmp --- a/docs/wiki/Examples--vga-pmp Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/Examples--vga-pmp Mon May 20 23:34:28 2019 +0200 @@ -1,8 +1,8 @@ = VGA Output Example (Parallel Mode Transfers) = -This example demonstrates the generation of an analogue VGA signal from a -PIC32 microcontroller using the parallel mode (parallel master port, PMP) -peripheral. The result is not entirely satisfactory: +This example demonstrates the generation of an analogue [[VGA Signal Output| +VGA]] signal from a PIC32 microcontroller using the parallel mode (parallel +master port, PMP) peripheral. The result is not entirely satisfactory: * Pixels are very narrow unless buffered using a flip-flop driven by the peripheral, this being a characteristic of the way the peripheral works, it @@ -81,33 +81,3 @@ HSYNC -> HS VSYNC -> VS }}} - -=== Output Socket Pinout === - -{{{ -5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) - - 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) - -15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) -}}} - -=== Output Cable Pinout === - -{{{ - 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) - -6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) - - 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) -}}} - -== References == - -https://en.wikipedia.org/wiki/VGA_connector - -http://papilio.cc/index.php?n=Papilio.VGAWing - -http://lucidscience.com/pro-vga%20video%20generator-2.aspx - -https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga diff -r d112c32b7417 -r a7af613384c7 docs/wiki/Examples--vga-timer --- a/docs/wiki/Examples--vga-timer Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/Examples--vga-timer Mon May 20 23:34:28 2019 +0200 @@ -1,10 +1,10 @@ = VGA Output Example (Timed DMA Transfers) = -This example demonstrates the generation of an analogue VGA signal from a -PIC32 microcontroller using general output pins. Unlike the [[../vga|vga]] and -[[../vga-pmp|vga-pmp]] examples, it employs a regular interrupt condition to -schedule single-byte (single-pixel) DMA transfers instead of a single -whole-line transfer. +This example demonstrates the generation of an analogue [[VGA Signal Output| +VGA]] signal from a PIC32 microcontroller using general output pins. Unlike +the [[../vga|vga]] and [[../vga-pmp|vga-pmp]] examples, it employs a regular +interrupt condition to schedule single-byte (single-pixel) DMA transfers +instead of a single whole-line transfer. The principal advantage of this method over the whole-line transfer method is its production of pixels with consistent widths. The principal disadvantage is @@ -115,33 +115,3 @@ HSYNC -> HS VSYNC -> VS }}} - -=== Output Socket Pinout === - -{{{ -5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) - - 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) - -15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) -}}} - -=== Output Cable Pinout === - -{{{ - 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) - -6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) - - 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) -}}} - -== References == - -https://en.wikipedia.org/wiki/VGA_connector - -http://papilio.cc/index.php?n=Papilio.VGAWing - -http://lucidscience.com/pro-vga%20video%20generator-2.aspx - -https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga diff -r d112c32b7417 -r a7af613384c7 docs/wiki/VGA_Output_Examples --- a/docs/wiki/VGA_Output_Examples Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/VGA_Output_Examples Mon May 20 23:34:28 2019 +0200 @@ -1,11 +1,18 @@ = VGA Output Examples = +A number of examples are provided to demonstrate the generation of a [[VGA +Signal Output|VGA-compatible video signal]] by the microcontroller: + * [[Examples/vga|vga]] * [[Examples/vga-cpu|vga-cpu]] * [[Examples/vga-dual|vga-dual]] * [[Examples/vga-pmp|vga-pmp]] * [[Examples/vga-timer|vga-timer]] +Each one mostly demonstrates the same thing as the others, but certain +implementation choices cause certain trade-offs to be made. Some of these are +discussed below. + == Comparison == In investigating different techniques, the following observations have been diff -r d112c32b7417 -r a7af613384c7 docs/wiki/VGA_Signal_Output --- a/docs/wiki/VGA_Signal_Output Sat May 04 22:54:18 2019 +0200 +++ b/docs/wiki/VGA_Signal_Output Mon May 20 23:34:28 2019 +0200 @@ -1,7 +1,12 @@ = VGA Signal Output = -There are two principal mechanisms for generating a VGA signal demonstrated in -this project: +A number of [[VGA Output Examples|examples]] demonstrate VGA signal generation +from a PIC32 microcontroller. These examples employ a particular [[VGA Signal +Wiring|wiring scheme]] in order to deliver signals to a suitable display or +monitor. + +Within the microcontroller, there are two principal mechanisms demonstrated in +this project for generating a VGA signal: * Using the CPU to "copy" pixel data to an output port * Using DMA transfers to "copy" pixel data to an output port diff -r d112c32b7417 -r a7af613384c7 docs/wiki/VGA_Signal_Wiring --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/VGA_Signal_Wiring Mon May 20 23:34:28 2019 +0200 @@ -0,0 +1,45 @@ += VGA Signal Wiring = + +The generation of a VGA-compatible video signal from a PIC32 microcontroller +is demonstrated by a number of [[VGA Output Examples|examples]]. Common to +these are certain hardware characteristics, described here to avoid +unnecessary repetition. + +== Pinouts == + +For the examples documented in this project, the following pinouts apply. VGA +connectors also support other signals, generally used for querying a display +for supported resolutions, but since a statically configured resolution is +employed by these examples, these other signals are left unconnected. + +=== Output Socket Pinout === + +{{{ +5 (GND) 4 (NC) 3 (B) 2 (G) 1 (R) + + 10 (GND) 9 (NC) 8 (GND) 7 (GND) 6 (GND) + +15 (NC) 14 (VS) 13 (HS) 12 (NC) 11 (NC) +}}} + +=== Output Cable Pinout === + +{{{ + 1 (R) 2 (G) 3 (B) 4 (NC) 5 (GND) + +6 (GND) 7 (GND) 8 (GND) 9 (NC) 10 (GND) + + 11 (NC) 12 (NC) 13 (HS) 14 (VS) 15 (NC) +}}} + +=== References === + + * [[WikiPedia:VGA connector]] + + * [[http://papilio.cc/index.php?n=Papilio.VGAWing|VGAWing]] + + * [[http://lucidscience.com/pro-vga%20video%20generator-2.aspx| + LucidScience - Build the VGA VIDEO GENERATOR - Page 2 of 16]] + + * [[https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga| + RGBI to VGA - H2Obsession]]