Microchip Technology Microstick for 3V PIC24 K Series Devices User’s Guide

Americas
Atlanta - 678-957-9614 Boston - 774-760-0087 Chicago - 630-285-0071 Cleveland - 216-447-0464 Dallas - 972-818-7423 Detroit - 248-538-2250 Indianapolis - 317-773-8323 Los Angeles - 949-462-9523 Phoenix - 480-792-7200 Santa Clara - 408-961-6444 Toronto - 905-673-0699
Europe
Austria - Wels - 43-7242-2244-39 Denmark - Copenhagen - 45-4450-2828 France - Paris - 33-1-69-53-63-20 Germany - Munich - 49-89-627-144-0 Italy - Milan - 39-0331-742611 Netherlands - Drunen - 31-416-690399 Spain - Madrid - 34-91-708-08-90 UK - Wokingham - 44-118-921-5869
Asia/Pacific
Australia - Sydney - 61-2-9868-6733 China - Beijing - 86-10-8569-7000 China - Chengdu - 86-28-8665-5511 China - Chongqing - 86-23-8980-9588
Microchip Technology Inc. • 2355 West Chandler Blvd. • Chandler, AZ 85224-6199
www.microchip.com
The Microchip name and logo, the Microchip logo, and MPLAB are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. REAL ICE and PICkit are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All other trademarks mentioned herein are property of their respective companies. © 2013, Microchip Technology Incorporated, Printed in the U.S.A. All Rights Reserved. 3/13
Asia/Pacific (Continued)
China - Hangzhou - 86-571-2819-3187 China - Hong Kong SAR - 852-2943-5100 China - Nanjing- 86-25-8473-2460 China - Qingdao - 86-532-8502-7355 China - Shanghai - 86-21-5407-5533 China - Shenyang - 86-24-2334-2829 China - Shenzhen - 86-755-8864-2200 China - Wuhan - 86-27-5980-5300 China - Xiamen - 86-592-2388138 China - Xian - 86-29-8833-7252 China - Zhuhai - 86-756-3210040 India - Bangalore - 91-80-3090-4444 India - New Delhi - 91-11-4160-8631 India - Pune - 91-20-2566-1512 Japan - Osaka - 81-6-6152-7160 Japan - Tokyo - 81-3-6880-3770 Korea - Daegu - 82-53-744-4301 Korea - Seoul - 82-2-554-7200 Malaysia - Kuala Lumpur - 60-3-6201-9857 Malaysia - Penang - 60-4-227-8870 Philippines - Manila - 63-2-634-9065 Singapore - 65-6334-8870 Taiwan - Hsin Chu - 886-3-5778-366 Taiwan - Kaohsiung - 886-7-213-7828 Taiwan - Taipei - 886-2-2508-8600 Thailand - Bangkok - 66-2-694-1351
2/21/13
Overview
The Microstick for 3V PIC24 K Series Devices is designed to provide an easy-to­use, economical development environment for 16-bit microcontrollers. The board includes an integrated debugger/programmer, a socket for the target micro­controller chip and pins that facilitate insertion into a prototyping board for extremely flexible development.
Installing MPLAB® IDE and C Compilers
The MPLAB® Integrated Development Environment (IDE) should be installed prior to using the Microstick for 3V PIC24 K Series Devices. This board is designed to run with MPLAB X IDE Version 1.60 or later. While the MPLAB IDE provides assembler tools for development, most code examples provided for Microchip devices are writ­ten in C language and require a C compiler to be installed. Microchip’s MPLAB XC16 Compiler seamlessly integrates into the MPLAB IDE. Both the MPLAB IDE and C Compiler are free and available for download at: www.microchip.com/mplabx and www.microchip.com/xc16, respectively.
Note 1: MPLAB XC16 Evaluation Version (free) – All optimization levels are
enabled for 60 days, then limits to optimization, Level O1. The compiler will continue to function, but code size may increase. There are no restrictions on the use of this C compiler (see license text for details).
Running Applications
After downloading and installing the development tools, please use the following procedure to build, run and debug your software:
1. Open the MPLAB X IDE application and close any open projects.
2. Open the Microstick application project by navigating to the installation directory and selecting the “pic24f16kl402_microstick_demo.X” folder.
3. Connect the Microstick board to the development computer via a USB cable.
4. Open the project properties by selecting File->Project Properties
5. Ensure the correct device is the selected device in the Device menu.
6. Select the Microstick from the Hardware Tool
Microchip Starter Kits>Starter Kits (PKOB)
7. Build, program and run the Microstick demo application by selecting
Debug>Debug Project
8. Install Jumper, JP1, to enable the on-board LED for RA0 to ensure the program is running.
For more information on building, running and debugging your application, refer to the MPLAB IDE Help.
.
(1)
.
dropdown
. It will be listed under
.
DS50002012B
Developing Applications
Microstick for 3V PIC24 K Series Devices only implements circuitry for low-voltage ICSP™ programming. To enable low-voltage ICSP programming, it is important to always configure the microcontroller to enable MCLR pin function, rather than RA5 general purpose, input pin function.
The following assembly language directive enables the MCLR device Configuration bits:
; MCLR Pin Enable bit (RA5 input disabled; MCLR enabled) config __FPOR, MCLRE_ON
In XC16, the same thing is accomplished with this code:
// MCLR Pin Enable bit (RA5 input disabled; MCLR enabled) FPOR(MCLRE_ON)
Warning: Always program the microcontroller with MCLR
enabled so that the Microstick for 3V PIC24 K Series Devices can be used to program/debug the chip in the future.
If the microcontroller is programmed with MCLR abled (RA5 input is enabled), the Microstick will no longer program or debug firmware on the microcontroller, because Microstick does not have circuitry to use high-voltage ICSP entry. REAL ICE™, MPLAB ICD 3 and PICkit™ 3 are examples of high-voltage ICSP tools that can be used to recover the part.
The slide switch, labeled S3 on the PCB, is used to select which pair of PGECx/ PGEDx pins to use for In-Circuit Serial Programming™ (ICSP™). When moved towards the PDIP socket, the Microstick is set for using PGEC3/PGED3. When moved towards the USB connector, the Microstick is configured for PGEC1/ PGED1.
To allow for debugging to work in MPLAB, the device’s Configuration bits must be set up to indicate which PGECx/PGEDx pins are actually being used in the circuit. For example, in assembly language, you may need directives such as this:
.include "p24Fxxxx.inc" ; ICD Pin Placement Select (EMUC/EMUD share PGC3/PGD3) config __FICD, ICS_PGx3
pin function in the
pin functionality
pin function dis-
Hardware Design
The Microstick for 3V PIC24 K Series Devices is USB bus powered. An on-board MCP1727 LDO regulator provides +3.3 VDC output from the USB bus power. Turning power on/off to the target application is controlled by the MPLAB IDE via the FPF2102 load switch. The FPF2102 load switch automatically shuts down power to the target if the current exceeds a trip point of 200 mA to 400 mA. This may help protect the host PC USB port from accidental shorting of power supply pins in the target application circuit.
The Microstick may be plugged into a prototyping board to develop external appli­cation circuitry with the PIC pins are provided, labeled P1, P2 and P3. Normally, the Skinny PDIP (SPDIP) layout (300 mils) should be used by populating rows, P1 and P2. Optionally, rows, P1 and P3, may be populated instead to provide a wide PDIP layout (600 mils).
®
MCU. On the bottom side of the board, three rows of
In XC16, the same thing can be accomplished with this code:
#include <p24Fxxxx.h> // ICD Pin Placement Select (EMUC/EMUD share PGC3/PGD3) _FICD(ICS_PGx3)
An XC16 firmware source code example for blinking the Microstick’s LED is provided on the Microchip web site (see http://www.microchip.com/microstick).
Introducing the Microstick for 3V PIC24 K Series Devices
VDD
PGED_MASTER
PGEC_MASTER
MCLR
V
DD
PGED1
PGEC1
U1RX
GND
V
DD
PGED3
V
DD
MCLR
PGEC_MASTER
PGED_MASTER
PGEC1
PGEC3
PGED1
PGED3
V
DD
GND
RA6
U1TX
PGEC3
U1RX
U1TX
V
DD
LED Jumper
D6
Red
R41
470R
C17
0.1 μF
C19
NL
22 pF
(32.768 kHz)
C21
NL
22 pF
R39
4.7k
C20
0.1 μF
R40
1k
C18
0.1 μF
V
DD
GND
TP1
TP2
J6
C14
10 μF
R42
NL
PIC24F16KL402
V
SS
V
DD
V
SS
V
DD
Application Hardware
DS50002012B
Introducing the Microstick for 3V PIC24 K Series Devices
UTIL_WP
UTIL_SDO
USB_D+
SCK
UTIL_CS
UTIL_SCK
USB_D-
C10
1 μF
1K
R16
+3.3V
R2
200K
C3
0.1 μF
VREF_2.5V
VPP_ON
C4
0.1 μF
R31
200K
C12
2.2 μF
+3.3V
C9
0.1 μF
+3.3V
+3.3V
SDI
UTIL_CS
SDO
UTIL_WP
R30
100K
USB_D-
USB_D+
UTIL_SDI
R28
100K
V
DD
Y1
12 MHz
R12
3.92K R15
10K
V
DD
C15
1 μF
R34
100K
3.16K
R17
+3.3V
+3.3V
R18
2.21K
R23
10K
R26
10K
R5
4.7K
R9
4.7K
100R
R22
ICSP_PGED_PICKIT3
ICSP_MCLR
_VPP_PICKIT3
UTIL_SDI
VDD_SENSE
VPP_GND
TARGET_POWER_ENABLE
VBUS_DEVICE_SWITCHED_SENSE
ASSEMBLY_ID_0
VPP_SENSE
R21
2.2K
+3.3V
ICSP_PGEC_PICKIT3
+3.3V
0R
R33
D2
Red
C7
1 μF
C11
0.1 μF
R24 10K
C8
1 μF
ICSP_PGED_PICKIT3
ICSP_PGEC_PICKIT3
VPP_SENSE
R10
330R
ICSP_MCLR
_VPP_PICKIT3
VBUS_DEVICE_SWITCHED_SENSE
TARGET_POWER_ENABLE
C2
0.1 μF
+3.3V
C13
0.01 μF
R37
NL
POWER_GOOD_PICKIT3
R14
100R
C1
10 μF
300 mA Limit
+3.3V
R6 10K
ASSEMBLY_ID_1
VPP_ON
VPP_GND
R13
100K
VDD_SENSE
SCK
SDI
R7
330R
R3
330R
SDO
MCLR
PGEC_MASTER
PGED_MASTER
R1
10K
R11 10K
R32
4.7K
MCP1727
U3
+3.3V
R38
0R
1
IN
5
OUT
4
FLAGB
3
ON
2
GND
U4
FPF2102
R8 10K
+3.3V
R19
2.21K R20
10K
R4
330R
Q3
MMBT3904
Q1
MMBT3906
POWER_GOOD_PICKIT3
UTIL_SCK
UTIL_SDO
Q2
MMBT3904
6
SCK
5
SI
1
CS
3
WP
4
V
SS
2
SO
8
V
CC
7
HOLD
U2
VSS VDD
AVDD
AVSS
VSS
VDD
VUSB
VBUS
VDD
VSS
VCAP/VDDCORE
VBUS
VIN
VOUT
VIN
+3.3V LD0
Regulator
22 pF
22 pF
PIC24FJ256GB106
(Local VDD/VSS bypass/decoupling.)
MINI-ICSP™ INTERFACE
TARGET ICSP™ SIGNALS
Debugger Hardware
DS50002012B
Loading...