paul@89 | 1 | Introduction
|
paul@112 | 2 | ============
|
paul@89 | 3 |
|
paul@89 | 4 | The CommonPIC32 distribution contains library code and examples demonstrating
|
paul@89 | 5 | various features and applications of MIPS-based products in the PIC32
|
paul@89 | 6 | microcontroller family. The following examples are provided:
|
paul@89 | 7 |
|
paul@89 | 8 | demo A demonstration of an assortment of peripherals, changing pin
|
paul@89 | 9 | output levels (to turn LEDs on and off) and communicating using a
|
paul@89 | 10 | UART peripheral.
|
paul@89 | 11 |
|
paul@89 | 12 | vga A collection of examples investigating approaches to provide an
|
paul@89 | 13 | vga-cpu analogue VGA signal, displaying the contents of the
|
paul@89 | 14 | vga-dual microcontroller's memory on a suitable display. Each example has
|
paul@89 | 15 | vga-pmp documentation describing its approach, benefits and limitations,
|
paul@89 | 16 | vga-timer but a summary is provided below.
|
paul@89 | 17 |
|
paul@112 | 18 | To build each example, run a command of the following form in the top-level
|
paul@112 | 19 | directory of this distribution:
|
paul@112 | 20 |
|
paul@112 | 21 | make -C examples/demo
|
paul@112 | 22 |
|
paul@112 | 23 | Here, the demo example is built.
|
paul@112 | 24 |
|
paul@112 | 25 | Although it should be possible to build different examples without cleaning
|
paul@112 | 26 | previous build artefacts, it can be useful to run a command of the following
|
paul@112 | 27 | form to start again with no build products:
|
paul@112 | 28 |
|
paul@112 | 29 | make -C examples/demo clean
|
paul@112 | 30 |
|
paul@112 | 31 | Deploying the software requires a suitable method of programming a PIC32
|
paul@112 | 32 | microcontroller. This is described below in the ICSP programming section.
|
paul@112 | 33 |
|
paul@112 | 34 |
|
paul@112 | 35 |
|
paul@89 | 36 | Contact, Copyright and Licence Information
|
paul@112 | 37 | ==========================================
|
paul@89 | 38 |
|
paul@89 | 39 | The author can be contacted at the following e-mail address:
|
paul@89 | 40 |
|
paul@89 | 41 | paul@boddie.org.uk
|
paul@89 | 42 |
|
paul@89 | 43 | Copyright and licence information can be found in the docs directory - see
|
paul@89 | 44 | docs/COPYING.txt and docs/gpl-3.0.txt for more information.
|
paul@89 | 45 |
|
paul@112 | 46 |
|
paul@112 | 47 |
|
paul@112 | 48 | Breadboard Circuit
|
paul@112 | 49 | ==================
|
paul@112 | 50 |
|
paul@112 | 51 | In order to be programmed and to function normally, the device needs to be
|
paul@112 | 52 | deployed in a circuit configured as follows:
|
paul@112 | 53 |
|
paul@112 | 54 | PIC32MX270F256B-50I/SP
|
paul@112 | 55 | ----------------------
|
paul@112 | 56 | MCLR# 3.3V (via 10K pull-up resistor)
|
paul@112 | 57 | VSS GND
|
paul@112 | 58 | VDD 3.3V
|
paul@112 | 59 | VSS GND
|
paul@112 | 60 | VCAP GND (via 10µF capacitor)
|
paul@112 | 61 | VUSB3V3 3.3V
|
paul@112 | 62 | AVSS GND
|
paul@112 | 63 | AVDD 3.3V
|
paul@112 | 64 |
|
paul@112 | 65 | "Figure 2-1: Recommended Minimum Connection" from the "PIC32MX1XX/2XX
|
paul@112 | 66 | 28/36/44-pin Family Data Sheet" stipulates additional 0.1µF ceramic capacitors
|
paul@112 | 67 | between VDD and VSS and between AVDD and AVSS.
|
paul@112 | 68 |
|
paul@112 | 69 |
|
paul@112 | 70 |
|
paul@112 | 71 | ICSP Programming Circuit
|
paul@112 | 72 | ========================
|
paul@112 | 73 |
|
paul@112 | 74 | To avoid limitations with JTAG programming and being unable to enable
|
paul@112 | 75 | JTAG-associated pins for other uses, the ICSP mechanism needs to be employed
|
paul@112 | 76 | instead. The circuit should resemble the following:
|
paul@112 | 77 |
|
paul@112 | 78 | PIC32MX270F256B-50I/SP Arduino
|
paul@112 | 79 | ---------------------- -------
|
paul@112 | 80 | MCLR# A0
|
paul@112 | 81 | PGEC1/PGEC2 A2 (pulled up via 2K2 resistor to 3.3V)
|
paul@112 | 82 | PGED1/PGED2 A1 (via 220ohm resistor, then pulled up via 2K2
|
paul@112 | 83 | resistor to 3.3V)
|
paul@112 | 84 |
|
paul@112 | 85 | The pull-up from MCLR# to VDD can apparently be left in place.
|
paul@112 | 86 |
|
paul@112 | 87 | The Pickle and Nanu Nanu software are used for programming:
|
paul@112 | 88 |
|
paul@112 | 89 | https://wiki.kewl.org/dokuwiki/projects:pickle
|
paul@112 | 90 | https://wiki.kewl.org/dokuwiki/projects:nanu-nanu
|
paul@112 | 91 |
|
paul@112 | 92 | Nanu Nanu can be deployed in the 5V-16M configuration on an Arduino
|
paul@112 | 93 | Duemilanove with an "open drain" or "sink" circuit as described above. Then,
|
paul@112 | 94 | the pload program provided by Pickle can be used to write the appropriate .hex
|
paul@112 | 95 | file as in the following example (probably as a privileged user):
|
paul@112 | 96 |
|
paul@112 | 97 | ./pload program /dev/ttyUSB0 examples/demo/demo.hex
|
paul@112 | 98 |
|
paul@112 | 99 | Note that the Pickle configuration file (~/.pickle or ~/.pickle/config) will
|
paul@112 | 100 | need to have the port and baudrate settings defined.
|
paul@112 | 101 |
|
paul@112 | 102 |
|
paul@112 | 103 |
|
paul@89 | 104 | VGA Output Example Comparison
|
paul@112 | 105 | =============================
|
paul@89 | 106 |
|
paul@89 | 107 | In investigating different techniques, the following observations have been
|
paul@89 | 108 | made about the behaviour of the different VGA examples:
|
paul@89 | 109 |
|
paul@89 | 110 | DMA Horizontal Picture Pixel Scrolling
|
paul@89 | 111 | Channels Resolution Stability Consistency Operational
|
paul@89 | 112 | -------- ---------- --------- ----------- -----------
|
paul@89 | 113 | vga 1 High No No Yes
|
paul@89 | 114 | vga-cpu 0 High Yes Yes Yes
|
paul@89 | 115 | vga-dual 2 High No No No
|
paul@89 | 116 | vga-pmp 1 High No No Yes
|
paul@89 | 117 | vga-timer 2 Low Yes Yes Yes
|
paul@89 | 118 |
|
paul@89 | 119 | Here, picture stability is assessed with the CPU accessing RAM. In general,
|
paul@89 | 120 | all of the approaches can provide stable pictures with limited RAM access
|
paul@89 | 121 | loading. However, under load, the picture will stretch and ripple for all
|
paul@89 | 122 | examples where picture stability is given as "No".
|
paul@89 | 123 |
|
paul@89 | 124 | It should be noted that the vga-timer example employs two DMA channels, but
|
paul@89 | 125 | this is only to maximise horizontal resolution. With a single channel,
|
paul@89 | 126 | horizontal resolution is diminished still further in comparison to the other
|
paul@89 | 127 | examples.
|
paul@89 | 128 |
|
paul@89 | 129 | It would appear that two most viable approaches are the vga-cpu and vga-timer,
|
paul@89 | 130 | if only because they produce consistently-sized pixels, retain picture
|
paul@89 | 131 | stability under load, and provide operational horizontal scrolling. These
|
paul@89 | 132 | approaches provide a tradeoff between performance (vga-timer being faster) and
|
paul@89 | 133 | resolution (vga-cpu being better).
|
paul@112 | 134 |
|
paul@112 | 135 |
|
paul@112 | 136 |
|
paul@112 | 137 | References
|
paul@112 | 138 | ==========
|
paul@112 | 139 |
|
paul@112 | 140 | Basic PIC32 breadboard circuit:
|
paul@112 | 141 |
|
paul@112 | 142 | http://umassamherstm5.org/tech-tutorials/pic32-tutorials/pic32mx220-tutorials/pic32mx220-breadboard
|