©2005 Microchip Technology Inc. DS01003A-page 7
AN1003
The SD card operates in the 2.7-3.6V range, whereas the
PIC18F4550 on the PICDEM FS USB Demonstration
Board requires a 5V VDD. The voltage regulation from 5V
to 3V is achieved using Microchip’s TC1186-3.3VCT713.
Appendix J: “Schematic” shows the schematic for the
PICtail™ Board for SD™ and MMC Cards (Part No.
AC164122). Pin 7 (RA5) of the PIC18F4550 is connected
to the SHDN (Shutdown input) pin of the TC1186 via
jumper JP4 (position 2-3). This enables the user to turn
off the SD card power using firmware (setting RA5 turns
the power on). Alternately, by changing the jumper JP4
setting (position 1-2), the user may turn the SD card
power on permanently. The PICtail™ Board for SD™
and MMC Cards also implements two MC74VHCT125A
devices as signal level translators for translating 5V DC
signals on the microcontroller side to 3.3V DC signals on
the SD card side and vice versa. The MC74VHCT125A
is a high-speed CMOS quad buffer fabricated with silicon
gate CMOS technology. Since it has a full 5.0V CMOS
level output swing, this device is ideal for signal level
translation between 3.0V and 5.0V levels. For 5V to 3.3V
signal translation, a supply voltage of 3.3V is applied to
U1 and corresponding OE pins are enabled (active-low).
Similarly, 3.3V to 5V translation is achieved by applying a
5V supply to U2 and enabling the corresponding OE
pins. Further details on the MC74VHCT125A can be
found in its respective data sheet (see “References”).
The PICtail™ Board for SD™ and MMC Cards also
features a power LED (D1), an SD card activity LED
(D2) and test points for monitoring the SPI bus. LED D1
indicates that power is available at the output of the
TC1186. LED D2 indicates SD card activity (based on
Chip Select signal, CS). The Serial Data Input (SDI),
Serial Clock (SCK), Serial Data Output (SDO), Chip
Select (CS) and Ground (GND) signals of the SPI bus
can be monitored on the test points. The PICtail™
Board for SD™ and MMC Cards is designed to operate
with a multitude of demonstration boards, including all
demonstration boards having PICtail signals, Explorer
16 development board having card edge connectors
and demonstration boards with non-standard PICtail
signals. The following jumper settings must be used for
operating the PICtail™ Board for SD™ and MMC
Cards with different demonstration boards.
1. If the demonstration board has standard PICtail
signals, connect JP1-JP2 and JP5 on the PICtail
side (default setting).
2. If the demonstration board provides card edge
signals, connect JP2-JP3 and JP5 on the card
edge side.
3. If the demonstration board does not provide
standard PICtail signals, open J3, jump signals
from J5 and J11 to appropriate signals on J2.
SCSI Commands
After the successful enumeration of the target USB
device, the host initiates commands according to the
bInterfaceSubClass specified in the interface
descriptor during the enumeration process.
The USB MSD application specifies bInterface-
SubClass = 06h, indicating that the device will support
SCSI Primary Commands-2 (SPC-2) or later. A
bInterfaceProtocol value of 0x50 in the interface
descriptor indicates that the BOT protocol is being
used. As shown in Figure 3, a BOT transfer begins with
a CBW. The device indicates the successful transport
of a CBW by accepting (ACKing) the CBW. If the host
detects a STALL of the Bulk-Out endpoint during Com-
mand transport, the host shall respond with a Reset
recovery. The host shall attempt to transfer an exact
number of bytes to or from the device as specified by
the dCBWDataTransferLength and the Direction
bit. The device shall send each CSW to the host via the
Bulk-In endpoint.
In this section, we briefly describe the SCSI commands
that are supported in the MSD implementation. The
reader may refer to SCSI Primary Commands-3 (SPC-3)
and SCSI Block Commands-2 (SBC-2) specifications for
further details (see “References”). The first byte of the
command block, CBWCB, is always the operation code or
opcode in short.
•INQUIRY (Opcode 12h)
The INQUIRY command requests that the informa-
tion regarding the logical unit and SCSI target device
be sent to the application client (host). The SPC-3
specification requires that the INQUIRY data should
be returned even though the device server is not
ready for other commands. Moreover, the standard
INQUIRY data should be available without incurring
any media access delays. The standard INQUIRY
data is at least 36 bytes.
•READ CAPACITY (Opcode 25h)
The READ CAPACITY command requests that the
device server transfer bytes of parameter data
describing the capacity and medium format to the
Data-In buffer. The response to the READ CAPACITY
command is 4 bytes of returned Logical Block
Address and 4 bytes of block length in bytes.
Returned Logical Block Address (LBA) is the
LBA of the last logical block on the direct access
block device. If the number of logical blocks exceeds
the maximum value that can be specified in the
returned Logical Block Address field, the
device shall set the returned Logical Block
Address field to FFFFFFFFh.
Note: The user application may not require the
signal translation if the PIC microcontroller
is operated at 3V.