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