MICROCHIP PIC24K

Microstick for 3V PIC24 K Series Devices
Overview
The Microstick for 3V PIC24 K Series Devices is designed to provide an easy-touse, economical development environment for 16-bit microcontrollers. The board
includes an integrated debugger/programmer, a socket for the target microcontroller chip and pins that facilitate insertion into a prototyping board for
extremely flexible development.
Installing MPLAB® IDE and C Compilers
Americas
Asia/Pacific
Europe
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-6445
Toronto - 905-673-0699
Australia - Sydney - 61-2-9868-6733
China - Beijing - 86-10-8569-7000
China - Chengdu - 86-28-8665-5511
China - Chongqing - 86-23-8980-9500
China - Hangzhou - 86-571-2819-3187
China - Hong Kong SAR - 852-2401-1200
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-8203-2660
China - Wuhan - 86-27-5980-5300
China - Xian - 86-29-8833-7252
China - Xiamen - 86-592-2388138
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 - Yokohama - 81-45-471-6166
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-7830
Taiwan - Taipei - 886-2-2500-6610
Thailand - Bangkok - 66-2-694-1351
Austria - Weis - 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
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 IDE Version 8.80 or later. While the MPLAB IDE provides assembler
tools for development, most code examples provided for Microchip devices are written in C language and require a C compiler to be installed. Microchip’s MPLAB C
Compiler seamlessly integrates into the MPLAB IDE. Both the MPLAB IDE and C
Compiler are free and available for download at: http://www.microchip.com/MPLAB
and http://www.microchip.com/MPLABC30, respectively.(1)
Note 1: MPLAB C Evaluation Version (free) – All optimization levels are
enabled for 60 days, then limits to optimization Level 1. 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).
08/02/11
Running Applications
After downloading and installing the development tools, please use the following
procedure to build, run and debug your software:
1.
2.
3.
4.
5.
6.
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. All other trademarks mentioned herein are property of
their respective companies. © 2011, Microchip Technology Incorporated, Printed in the U.S.A. All Rights
Reserved. 10/11
DS52012A
7.
8.
Load the code example into MPLAB IDE by double clicking the *.mcw project
file.
Inform MPLAB IDE which target microcontroller is plugged into the Microstick
board by selecting the appropriate device from the Configure>Select
Device>Device menu.
Build the project by selecting Project>Build All.
Connect the Microstick board to the development computer via a USB cable.
Enable the MPLAB IDE debugger by selecting:
Debugger>Select Tool>Starter Kit on Board.
Download the firmware into the target microcontroller chip by selecting
Debugger>Program.
Run the application previously downloaded by selecting Debugger>Run.
Install Jumper JP1 to enable the on-board LED for RA0.
For more information on building, running and debugging your application, refer to
the MPLAB IDE Help.
Developing Applications
Hardware Design
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 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 following assembly language directive enables the MCLR pin function in the
device Configuration bits:
; MCLR Pin Enable bit (RA5 input disabled; MCLR enabled)
config __FPOR, MCLRE_ON
In C30, 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 pin functionality
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 pin function disabled (RA5 input 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 an example 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 DIP 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
In C30, the same thing can be accomplished with this code:
#include <p24Fxxxx.h>
// ICD Pin Placement Select (EMUC/EMUD share PGC3/PGD3)
_FICD(ICS_PGx3)
A C30 firmware source code example for blinking the Microstick’s LED is provided
on the Microchip web site (see http://www.microchip.com/microstick3V).
The Microstick may be plugged into a prototyping board to develop external application circuitry with the PIC® MCU. On the bottom side of the board, three rows of
pins are provided, labeled P1, P2 and P3. Normally, the skinny DIP 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 DIP layout (600 mils). The
unpopulated, single in-line pin header for soldering into P3 is available separately
as Digi-Key Part Number ED7464-ND.
Using the 16-Bit XLP Development Board
In the skinny DIP layout configuration (rows, P1 and P2, are populated), the Microstick may be plugged into Microchip’s “16-Bit XLP Development Board”. The 16-Bit
XLP Development Board provides several external buttons, LEDs, peripherals and
sensors that can be used to quickly evaluate the device without spending time
wiring a breadboard.
Warning: Always remove batteries and/or the “POWER SOURCE SELECT”
jumper from the 16-Bit XLP Development Board, prior to inserting
the Microstick board. The Microstick for 3V PIC24 K Series Devices
is intended to supply power to the target application, which could
cause an unintended charging of batteries connected to the 16-Bit
XLP Development Board.
The 16-Bit XLP Development Board may come with a USB-to-Serial or RS-232
serial port wired to the PIC microcontroller’s U2TX/U2RX pins. To avoid conflict
with the on-board serial port circuitry, slide S3 of the Microstick to the PGEC3/
PGED3 setting (move the switch lever towards the DIP socket).
Introducing the Microstick for 3V PIC24 K Series Devices
Application Hardware
VDD
MCLR
R39
4.7k
C20
0.1 μF
PGEC1
PGEC_MASTER
R40
PGEC3
PGED1
1k
PGED_MASTER
PGED3
VDD
PGED_MASTER
PGEC_MASTER
D6
VDD
VDD
VSS
GND
LED Jumper
PGEC1
U1RX
MCLR
R41
470R
GND
VDD
TP1
C18
0.1 μF
PGED1
Red
VDD
GND
J6
VSS
RA6
U1RX
VDD
VDD
C17
U1TX
VDD
PGEC3
PGED3
0.1 μF
C19
NL
22 pF
(32.768 kHz)
C21
NL
22 pF
U1TX
PIC24F16KL402
R42
NL
DS52012A
Introducing the Microstick for 3V PIC24 K Series Devices
Debugger Hardware
+3.3V
+3.3V
C1
C2
C3
C4
0.1 μF
0.1 μF
0.1 μF
10 μF
UTIL_WP
(Local VDD/VSS bypass/decoupling.)
MINI-ICSP™
INTERFACE
UTIL_CS
+3.3V
SDO
TARGET ICSP™ SIGNALS
SDI
TARGET_POWER_ENABLE
SCK
R1
10K
R2
200K
ICSP_ MCLR_VPP_PICKIT3
VBUS_DEVICE_SWITCHED_SENSE
R3
SDO
ICSP_PGEC_PICKIT3
VPP_ON
VPP_GND
PGED_MASTER
330R
+3.3V
VCAP/VDDCORE
ICSP_PGED_PICKIT3
R5
4.7K
R4
R6
10K
ASSEMBLY_ID_1
SDI
330R
ASSEMBLY_ID_0
R7
UTIL_SDO
SCK
PGEC_MASTER
330R
UTIL_SDI
R8
10K
+3.3V
R9
4.7K
R10
PIC24FJ256GB106
ICSP_ MCLR_VPP_PICKIT3
330R
+3.3V
22 pF
UTIL_SCK
VSS
VSS
VDD
+3.3V
Y1
VDD
12 MHz
VDD
U2
1
UTIL_CS
3
UTIL_WP
7
R21
2.2K
VCC
SO
SI
2
VPP_SENSE
UTIL_SDI
USB_D-
VUSB
VDD_SENSE
R16
VBUS
SCK
1K
VREF_2.5V
CS
+3.3V
R14
VDD_SENSE
100R
VPP_SENSE
3.16K
HOLD
C7
VSS
4
R15
10K
R13
100K
Q1
MMBT3906
R18
2.21K
R17
WP
VSS
6
UTIL_SCK
R12
3.92K
22 pF
VDD
5
UTIL_SDO
USB_D+
+3.3V
8
AVDD
AVSS
R11
10K
R19
2.21K
R20
10K
MCLR
1 μF
ICSP_PGEC_PICKIT3
R22
ICSP_PGED_PICKIT3
+3.3V
R23
VPP_ON
R24
10K
C8
C9
1 μF
0.1 μF
POWER_GOOD_PICKIT3
Q2
100R
MMBT3904
10K
+3.3V
R26
Q3
MMBT3904
VPP_GND
10K
C15
R34
100K
1 μF
VDD
R37
R28
NL
U3
VBUS
VIN
VIN
USB_DUSB_D+
D2
C10
Red
1 μF
R32
4.7K
U4
+3.3V
VOUT
R38
1
0R
2
3
TARGET_POWER_ENABLE
MCP1727
R31
200K
C11
C12
C13
0.1 μF
2.2 μF
0.01 μF
100K
R30
100K
IN
OUT
5
GND
ON FLAGB
4
VBUS_DEVICE_SWITCHED_SENSE
FPF2102
300 mA Limit
+3.3V LD0
Regulator
R33
0R
POWER_GOOD_PICKIT3
DS52012A