R6
10K
3V3
23 PSB
RESET 40
E
R/ W
CSB
RS
D0
3V3
D1
D2
D3
D4
D5
D6
D7
28
29
30
31
32
33
34
35
36
37
38
39
VOUT
VIN
25
24
SDO
CLK
R5
3V3
C13
100nF
LED1
BLUE LED
3V3
C14
1.0uF
C15
1.0uF
Y2 32.768 KHz
C9
Y1 12 MHz
C7
20pF
C8
12pF
C6
20pF
SDO = MISO
SDI = MOSI
microSD CONNECTOR
1
2
3
4
5
6
7
8
NOTE:
1. THE SLAVE SPI DEVICES ARE LABELED IN THE PERSPEC TIVE OF THE PIC18F47J53.
CS
3V3
SCK
SDO
R1
10K
3V3
C3
100nF
R2
3V3
C2
100nF
C1
1
C2
EN
IN
C1
100nF
100nF
2
4
U1
MC74VHC1GT125DT
53
SDI
EDTP microSD INTERFACE CARD
10K
R1
SCK
CS
34
35
36
37
38
39
40
41
42
43
44
NC
RC1/RP12
RC2/RP13
VUSB
R D0
R D1
R D2/R P19
R D3/R P20
R C 4/D-
R C5/D+
R C6/R P17
PIC18F47J53
12
13
14
15
16
17
18
19
20
21
22
NC
NC
R B4/R P7
R B5/R P8
R B6/R P9
R B7/R P10
M CLR
R A0/R P0
R A1/R P1
R A2
R A3
3V3
R2
100
C10
4.7uF
VBUS
CSB
1
6
1
2
2
3
4
5
6
3
4
5
3V3
R3
1.5K
C12
R4
100K
U1
MINI-B USB RECP T
1uF
SWITCHED_3V3
3V3
GATE
VR1 TC1262-3.3
1 3 IN OUT
C11
3V3
DMP2123L
Q1
1
2
VBUS
EXT-5V0
1
2
3
4
5
6
ICSP
58
December 2010
■ SCHEMATIC 1. This is almost as bare bones
as this design can get. We can trim more fat by
eliminating the crystals, their load capacitors,
and the voltage regulator circuitry.
Our work will be performed within the
ProcessIO function which resides in the
main.c project file. Before we write our test
code, we need to place an entry in the
Variables area of the main.c file:
unsigned char
nvdata[CDC_DATA_OUT_EP_SIZE];
The CDC_DATA_OUT_EP_SIZE value is
located in the usb_config.h file which is also
part of our project:
#define CDC_DATA_OUT_EP_SIZE 64
With a little help from the
usb_function_cdc.c file, we can now write
our test code:
if(USBUSARTIsTxTrfReady())
{
char nvdata[] = “DESIGN CYCLE -
USCM-47J53\r\n”;
putsUSBUSART(nvdata);
}
The putsUSBUSART function resides
within the usb_function_cdc.c file. Here’s a
quote from the putsUSBUSART function
description header:
Summary:
putsUSBUSART writes a string of
data to the USB including the null
character. Use this version, ‘puts’,
to transfer data from a RAM buffer.
Before we called upon the
putsUSBUSART, we allocated a 64-byte
buffer called nvdata. Once the nvdata
buffer was allocated, we loaded nvdata
with a null-terminated string. The call to the
putsUSBUSART function produced the
results you see in the Tera Term Pro
terminal emulator session captured in
Screenshot 2. To allow you to see everything
associated with our little bit of test code, I’ve
included the entire project in the download
package.
THE USCM-47J53
SPI PORTAL
If we desire to store and read data using
the microSD card, we must construct the
base for a SPI portal. Likewise, if we wish to
view messages via the EA DOGM162L-A —
which we’ve configured in SPI mode — a SPI