paul@0 | 1 | Introduction
|
paul@0 | 2 | ------------
|
paul@0 | 3 |
|
paul@0 | 4 | The BlinkPIC32 project provides software and circuit information to
|
paul@0 | 5 | demonstrate a trivial LED-blinking application using a PIC32 microcontroller,
|
paul@0 | 6 | in particular one with a DIP-28 profile that can be set up on a breadboard.
|
paul@0 | 7 |
|
paul@0 | 8 | Contact, Copyright and Licence Information
|
paul@0 | 9 | ------------------------------------------
|
paul@0 | 10 |
|
paul@0 | 11 | The author can be contacted at the following e-mail address:
|
paul@0 | 12 |
|
paul@0 | 13 | paul@boddie.org.uk
|
paul@0 | 14 |
|
paul@0 | 15 | Copyright and licence information can be found in the docs directory - see
|
paul@0 | 16 | docs/COPYING.txt and docs/gpl-3.0.txt for more information.
|
paul@0 | 17 |
|
paul@0 | 18 |
|
paul@0 | 19 |
|
paul@0 | 20 | Using the Software
|
paul@0 | 21 | ==================
|
paul@0 | 22 |
|
paul@0 | 23 | The software to be transferred to the microcontroller can be built as follows:
|
paul@0 | 24 |
|
paul@0 | 25 | make
|
paul@0 | 26 |
|
paul@0 | 27 | This should produce a file called blink.hex that can then be transferred to the
|
paul@0 | 28 | device. This will toggle an output that can be connected to a light-emitting
|
paul@0 | 29 | diode (LED) to demonstrate the operation of the program.
|
paul@0 | 30 |
|
paul@0 | 31 |
|
paul@0 | 32 |
|
paul@0 | 33 | Hardware Details
|
paul@0 | 34 | ================
|
paul@0 | 35 |
|
paul@0 | 36 | The following pinout provides a summary of the pertinent functions associated
|
paul@0 | 37 | with the pins on the microcontroller.
|
paul@0 | 38 |
|
paul@0 | 39 | PIC32MX270F256B-50I/SP Pinout
|
paul@0 | 40 | -----------------------------
|
paul@0 | 41 |
|
paul@0 | 42 | 5 MCLR# 1 \/ 28 AVDD
|
paul@0 | 43 | cap RA0 2 27 AVSS
|
paul@0 | 44 | cap RA1 3 26 RB15 ap
|
paul@0 | 45 | cap PGED1/RB0 4 25 RB14 a
|
paul@0 | 46 | cap PGEC1/RB1 5 24 RB13 ap
|
paul@0 | 47 | cap RB2 6 23 VUSB3V3
|
paul@0 | 48 | cap RB3 7 22 RB11/PGEC2
|
paul@0 | 49 | VSS 8 21 RB10/PGED2
|
paul@0 | 50 | c RA2 9 20 VCAP
|
paul@0 | 51 | cp RA3 10 19 VSS
|
paul@0 | 52 | c RB4 11 18 RB9/TDO 5cp
|
paul@0 | 53 | cp RA4 12 17 RB8/TCK 5cp
|
paul@0 | 54 | VDD 13 16 RB7/TDI 5cp
|
paul@0 | 55 | 5c TMS/RB5 14 15 VBUS 5
|
paul@0 | 56 |
|
paul@0 | 57 | default pin supply limitation of -0.3V to VDD + 0.3V
|
paul@0 | 58 | 5 = 5V-tolerant pin with supply limitation of -0.3V to 5.5V if VDD >= 2.3V
|
paul@0 | 59 | a = analogue/digital pin
|
paul@0 | 60 | c = permit change notification configuration
|
paul@0 | 61 | p = parallel master/slave port pin
|
paul@0 | 62 |
|
paul@0 | 63 | Thus, there should be up to 5 5V-tolerant I/O pins.
|
paul@0 | 64 |
|
paul@0 | 65 | The microcontroller can be set up to function normally in a breadboard circuit
|
paul@0 | 66 | and also be connected up to a programming circuit at the same time. This
|
paul@0 | 67 | permits immediate feedback about the programming of the device without the
|
paul@0 | 68 | need to connect and disconnect the programmer.
|
paul@0 | 69 |
|
paul@0 | 70 |
|
paul@0 | 71 |
|
paul@0 | 72 | Breadboard Circuit
|
paul@0 | 73 | ==================
|
paul@0 | 74 |
|
paul@0 | 75 | In order to be programmed and to function normally, the device needs to be
|
paul@0 | 76 | deployed in a circuit configured as follows:
|
paul@0 | 77 |
|
paul@0 | 78 | PIC32MX270F256B-50I/SP
|
paul@0 | 79 | ----------------------
|
paul@0 | 80 | MCLR# 3.3V (via 10K pull-up resistor)
|
paul@0 | 81 | VSS GND
|
paul@0 | 82 | VDD 3.3V
|
paul@0 | 83 | VSS GND
|
paul@0 | 84 | VCAP GND (via 10µF capacitor)
|
paul@0 | 85 | VUSB3V3 3.3V
|
paul@0 | 86 | AVSS GND
|
paul@0 | 87 | AVDD 3.3V
|
paul@0 | 88 |
|
paul@0 | 89 | "Figure 2-1: Recommended Minimum Connection" from the "PIC32MX1XX/2XX
|
paul@0 | 90 | 28/36/44-pin Family Data Sheet" stipulates additional 0.1µF ceramic capacitors
|
paul@0 | 91 | between VDD and VSS and between AVDD and AVSS.
|
paul@0 | 92 |
|
paul@0 | 93 |
|
paul@0 | 94 |
|
paul@0 | 95 | Demonstration Circuit
|
paul@0 | 96 | =====================
|
paul@0 | 97 |
|
paul@0 | 98 | To test the software payload, the RA3 pin should be connected to a LED in
|
paul@0 | 99 | series with a 100 ohm resistor, routing to GND.
|
paul@0 | 100 |
|
paul@0 | 101 | PIC32MX270F256B-50I/SP
|
paul@0 | 102 | ----------------------
|
paul@0 | 103 | RA3 LED -> GND (via 100 ohm resistor)
|
paul@0 | 104 |
|
paul@0 | 105 |
|
paul@0 | 106 |
|
paul@0 | 107 | ICSP Programming Circuit
|
paul@0 | 108 | ========================
|
paul@0 | 109 |
|
paul@0 | 110 | To avoid limitations with JTAG programming and associated limitations it may
|
paul@0 | 111 | impose on pin usage, the ICSP mechanism needs to be employed instead. The
|
paul@0 | 112 | circuit should resemble the following:
|
paul@0 | 113 |
|
paul@0 | 114 | PIC32MX270F256B-50I/SP Arduino
|
paul@0 | 115 | ---------------------- -------
|
paul@0 | 116 | MCLR# A0
|
paul@0 | 117 | PGEC1/PGEC2 A2 (pulled up via 2K2 resistor to 3.3V)
|
paul@0 | 118 | PGED1/PGED2 A1 (via 220ohm resistor, then pulled up via 2K2
|
paul@0 | 119 | resistor to 3.3V)
|
paul@0 | 120 |
|
paul@0 | 121 | The pull-up from MCLR# to VDD can apparently be left in place.
|
paul@0 | 122 |
|
paul@0 | 123 | The Pickle and Nanu Nanu software are used for programming:
|
paul@0 | 124 |
|
paul@0 | 125 | https://wiki.kewl.org/dokuwiki/projects:pickle
|
paul@0 | 126 | https://wiki.kewl.org/dokuwiki/projects:nanu-nanu
|
paul@0 | 127 |
|
paul@0 | 128 | Nanu Nanu can be deployed in the 5V-16M configuration on an Arduino
|
paul@0 | 129 | Duemilanove with an "open drain" or "sink" circuit as described above. Then,
|
paul@0 | 130 | the pload program provided by Pickle can be used to write the boot.hex file as
|
paul@0 | 131 | follows (as a sufficiently privileged user):
|
paul@0 | 132 |
|
paul@0 | 133 | ./pload program /dev/ttyUSB0 blink.hex
|
paul@0 | 134 |
|
paul@0 | 135 | Note that the Pickle configuration file (~/.pickle or ~/.pickle/config) will
|
paul@0 | 136 | need to have the port and baudrate settings defined. For example:
|
paul@0 | 137 |
|
paul@0 | 138 | DEVICE=/dev/ttyUSB0
|
paul@0 | 139 | BAUDRATE=115200
|
paul@0 | 140 | DEBUG=1
|
paul@0 | 141 |
|
paul@0 | 142 |
|
paul@0 | 143 |
|
paul@0 | 144 | References
|
paul@0 | 145 | ==========
|
paul@0 | 146 |
|
paul@0 | 147 | Basic PIC32 breadboard circuit:
|
paul@0 | 148 |
|
paul@0 | 149 | http://umassamherstm5.org/tech-tutorials/pic32-tutorials/pic32mx220-tutorials/pic32mx220-breadboard
|
paul@0 | 150 |
|
paul@0 | 151 | ArduPIC32 JTAG-based programmer:
|
paul@0 | 152 |
|
paul@0 | 153 | http://www.microchip.com/forums/m653443.aspx
|
paul@0 | 154 | https://code.google.com/archive/p/ardupic32/
|