Getting Started: Running the “Device
– Mass Storage – SD™ Card data logger” demo
Configuration
1: PIC18F87J50 PIM + HPC Explorer
Configuration
3: PIC18F46J50 Full Speed USB Demo Board + HPC Explorer
Configuration
1: PIC18F87J50 PIM + HPC Explorer
Configuration
3: PIC18F46J50 Full Speed USB Demo Board + HPC Explorer
Reading
the Data on the Computer
To run this project, you will need one of the
following sets of hardware:
PIC18F87J50
Plug-In-Module (PIM) (MA180021)
High
pin count (HPC) Explorer (DM183022)
SD Card
PICTail™ Plus Daughter Card (AC164122)
Explorer
16 (DM240001)
USB
PICtail™ Plus Daughter Card (AC164131)
And one of the following PIMs
PIC24FJ64GB004
Plug-In-Module (PIM) (MA240019)
PIC24FJ256GB110 Plug-In-Module (PIM) (MA240014)
PIC32MX USB Plug-In-Module (PIM) (MA320002)
PIC18F46J50
Full Speed USB Demo Board (MA180024)
High
pin count (HPC) Explorer (DM183022)
SD
Card PICTail™ Plus Daughter Card (AC164122)
This
section describes how to set up the various configurations of hardware to run
this demo.
Configuration 1: PIC18F87J50 PIM + HPC Explorer
Configuration 3: PIC18F46J50 Full Speed USB Demo Board
1)
Before attaching the PIC18F87J50 PIM to the HPC Explorer board, insure that the
processor selector switch (S3) is in the “ICE” position as seen in the image
below. Failure to so will result in
difficulties in getting the PIC18F87J50 PIM to sit properly on the HPC
Explorer.
2)
Short JP4 on the PIC18F87J50 PIM. This
allows the demo board to be powered through bus power.
3)
Short JP1 such that the “R” and “U” options are shorted.
4)
Before connecting the PIC18F87J50 PIM to the HPC Explorer board, remove all
attached cables from both boards.
Connect the PIC18F87J50 PIM to the HPC Explorer board. Be careful when connecting the boards to
insure that no pins are bent or damaged during the process. Also insure that the PIM is not shifted in
any direction and that all of the headers are properly aligned.
5)
On the SD Card PICTail™ Plus board, short JP1, JP2, and JP3 on the side
farthest from the SD Card holder.
Depending on the revision of the board you have the silk-screen on the
board may incorrectly label the top as the “HPC-EXP” setting. Please ignore this silk screen and place the
jumpers as described above and seen below.
6) Connect the SD Card
PICTail Plus board to the HPC Explorer board.
This may require the addition of female headers onto the HPC Explorer
board and possibly male headers on the SD Card PICTail Plus board. Make sure when connecting the two boards
together that the pin names as printed on both boards match up as they are
connected.
1)
Before attaching the PIM to the Explorer 16 board, insure that the processor
selector switch (S2) is in the “PIM” position as seen in the image below.
2)
Short the J7 jumper to the “PIC24” setting
3)
Before connecting the PIM to the Explorer 16 board, remove all attached cables
from both boards. Connect the PIM to the
Explorer 16 board. Be careful when
connecting the boards to insure that no pins are bent or damaged during the
process. Also insure that the PIM is not
shifted in any direction and that all of the headers are properly aligned.
4)
On the SD Card PICTail Plus board, short JP1, JP2, and JP3 on the side farthest
from the SD Card holder. Depending on
the revision of the board you have the silk-screen on the board may incorrectly
label the top as the “HPC-EXP” setting.
Please ignore this silk screen and place the jumpers as described above
and seen below.
5) Connect the SD Card
PICTail Plus board to the HPC Explorer board in either the female PICTail Plus
connectors. Attach the board in the top
bay of either of the connectors.
6) On the USB PICTail Plus board, short jumper
JP1. Remove all other shorts on the board.
7) Connect the USB PICTail Plus board to either
of the female PICTail Plus connectors or on the card edge connector (J9) at the
edge of the Explorer 16 board.
Note: When using the HID bootloader for PIC32, it is
important to modify the procdefs.ld file to relocate the sections of code that
will hold the bootloader and those sections that will hold the user application. Example modified procdefs.ld files have been
provided with each project. This file is
currently named “Procdefs.ld.boot”. When
using the example project with the bootloader it is required to remove the
“.boot” section of the file. This will
allow MPLAB to use this file instead of the default linker file. Once the linker file is renamed, however, the
project will no longer work without the bootloader. Please rename the file in order to get the
project working again with PIC32.
1)
Before attaching the PIC18F46J50 Full Speed USB Demo Board to the HPC Explorer
board, insure that the processor selector switch (S3) is in the “ICE” position
as seen in the image below. Failure to
so will result in difficulties in getting the PIC18F46J50 Full Speed Demo Board
to sit properly on the HPC Explorer.
2) Short JP3 to allow the board to be powered from the USB.
3)
Before connecting the PIC18F46J50 Full Speed USB Demo Board to the HPC Explorer
board, remove all attached cables from both boards. Connect the PIC18F46J50 Full Speed USB Demo
Board to the HPC Explorer board. Be
careful when connecting the boards to insure that no pins are bent or damaged
during the process. Also insure that the
PIM is not shifted in any direction and that all of the headers are properly
aligned.
4)
On the SD Card PICTail™ Plus board, short JP1, JP2, and JP3 on the side
farthest from the SD Card holder. Depending
on the revision of the board you have the silk-screen on the board may
incorrectly label the top as the “HPC-EXP” setting. Please ignore this silk screen and place the
jumpers as described above and seen below.
5) Connect the SD Card
PICTail Plus board to the HPC Explorer board.
This may require the addition of female headers onto the HPC Explorer
board and possibly male headers on the SD Card PICTail Plus board. Make sure when connecting the two boards
together that the pin names as printed on both boards match up as they are
connected.
To
run this project, you will need to load the corresponding firmware into the
devices. There are two methods available
for loading the demos: Precompiled demos and source code projects.
Precompiled
Demos are available in the “<Install Directory>\USB – Precompiled Demos”
folders. Each demo should be prefaced
with the hardware platform it is compiled for.
Select the file that matches the hardware that you have and the demo
that you want to run. For more
information about how to load a precompiled project, please see the “Getting
Started – Loading a precompiled demo” guide.
The
source code for this demo is available in the “<Install Directory\USB Device
– Mass Storage – SD Card data logger” directory. In this directory you will find all of the
user level source and header files as well as project and workspace files for
each of the hardware platforms. Find the
project (*.mcp) or workspace (*.mcw) file that
corresponds to the hardware platform you wish to test. Compile and program the demo code into the
hardware platform. For more help on how
to compile and program projects, please refer to the MPLAB help available
through the help menu of MPLAB (Help->Topics…->MPLAB IDE).
Please
note that when using either the C30 or C32 demo projects you will be required
to select the correct processor for the demo board.
1) Open the associated project file
2) In MPLAB Select
“Configure->Select Device”
3) In the device list box in the top
left corner of that window, select the desired device.
NOTE
WHEN USING THE HID BOOTLOADER (for PIC18F87J50 PIM): The “USB Device - Mass
Storage - SD Card reader” and “USB Device - Mass Storage - SD Card data logger”
demos make use of the SD Card PICtail Daughter Board (Microchip® Direct:
AC164122). This PICtail uses the RB4 I/O
pin for the card detect (CD) signal, and is actively driven by the
PICtail. The active drive overpowers the
pull up resistor on the RB4 pushbutton (on the PIC18F87J50 FS USB Plug-In
Module board). As a result, if the
PIC18F87J50 is programmed with the HID bootloader, and an SD Card is installed
in the socket when the microcontroller comes out of reset, the firmware will
immediately enter the bootloader (irrespective of the RB4 pushbutton
state). To exit the bootloader
firmware, remove the SD Card from the SD Card socket, and tap the MCLR
button. When the SD Card is not plugged
in, the PICtail will drive the card detect signal (which is connected to RB4)
logic high, which will enable the bootloader to exit to the main application
after coming out of reset. Once the main
application firmware is operating, the SD Card can be plugged in. The SD Card is “hot-swappable” and should be
recognized by the host upon insertion.
To avoid this inconvenience when using the bootloader with the PICtail,
it is suggested to modify the bootloader firmware to use some other I/O pin for
bootloader entry, such as RB0 (which has a pushbutton on it on the HPC Explorer
board).
This
demo uses the selected hardware platform as both a SD card reader as well as a
data logger.
1) Make sure that there is a FAT or FAT32
formatted SD card in the card reader.
This can be done by either connecting the device to a regulator SD card
reader or connecting the hardware platform to the computer through the USB
cable. The device should appear as a
new drive on the computer named “
2) Once the drive appears, right click on the
drive and select properties. The file
system property should read “FAT”. If it
is anything other than “FAT” then this demo will not work correctly. The firmware provided is only capable of
writing to “FAT” formatted systems. SD
cards less than 2GB are typically shipped in a “FAT” format.
3) Power the demo board if it is not powered
already.
4a)
PIC18F87J50 PIM + HPC Explorer: press
and hold the “S1” button on the HPC Explorer board. This will start recording the potentiometer
data from the HPC Explorer board to the SD Card. While still holding the “S1” button, vary the
potentiometer. Release the button.
4b)
Explorer 16: press and hold the “S3” button on the Explorer 16 board. This will start recording the potentiometer
data from the HPC Explorer board to the SD Card. While still holding the “S3” button, vary the
potentiometer. Release the button.
PIC18F46J50 Full Speed USB Demo Board:
Reading the Data on the
Computer:
Connect
the hardware platform to a computer through a USB cable. If the device was attached to the computer
while the data logging occurred, you may need to remove the SD card from the
card slot or disconnect and reconnect the device from the computer for the
files to appear. Most computers are not
expecting the files on an attached drive to change if they are not making the
change so some operating systems will not look for additional drive changes.
The
device should appear as a new drive on the computer named “
If
no SD Card is inserted in the SD Card PICTail Plus, the following dialog will pop-up.
Once
a compatible card is inserted in the card reader, files can be read, deleted,
and manipulated like any other drive on the computer. If the instructions in the “Logging Data” are
performed, there should be a “LOG.CSV” file on the card.
This
file can be read by a simple text editor program or graphical/statistical
programs, like Microsoft® Excel®.
To
plot the data in Excel, select the entire column that contains the data.
Click
on the chart wizard button.
Select
the “Line” option chart.
Click
“Next” and “Finish” until the chart is generated.
Toubleshooting Tips:
Issue
1: The device appears correctly in the
device manager, but no new drive letters appear on a Windows® operating system
based machine.
Solution: See Microsoft knowledge base article
297694:
http://support.microsoft.com/kb/297694
If there is a drive letter conflict (ex: because a network
drive has been mapped to a letter low in the alphabet), on some operating
systems, the newly attached USB drive may not appear. If this occurs, either obtain the hotfix from
Microsoft, or remap the conflicting mapped network drive to a letter at the end
of the alphabet (ex: Z:).
The Microchip name and logo, the Microchip logo,
MPLAB, and PIC are registered trademarks of Microchip Technology Incorporated
in the
PICDEM and PICTail are
trademarks of Microchip Technology Incorporated in the
SD is a trademark of the SD Association in the
U.S.A and other countries
Microsoft, Windows,
Excel, and Windows Vista are either registered trademarks or trademarks of
Microsoft Corporation in the