were created by the main application code.
■ Photo 1. The PIC32MX795F512L is
loaded for bear as far as clocks and
crystals are concerned. You can also see
that the built-in Ethernet capabilities of
the PIC are being fully utilized.
That does it for prepping the
hardware via firmware.
To give you a physical perspective
of the PIC and microSD hardware, I’ve
snapped Photo 1.
Does It Work?
I’ll bet it will. However, we need to
twiddle some bits in the main project
file. Normally, I like to have a serial
port up and operational to assist in
debugging. I have plans for that, but
right now I only want to know if the
microSD card code is working. So,
instead of a full-blown serial port, we
will settle for an LED indication at the
successful completion of the program
run. We will set that up like this:
TRISAbits.TRISA3 = 0;
LATAbits.LATA3 = 0;
The LED driven by I/O pin RA3 is
identified as USERLED1 in Schematic
1. To help relieve the current load on
the RA3 I/O pin, a NUD3105 relay
driver buffers the current load used by
We will indicate a successful
program by illuminating USERLED1.
■ Screenshot 1. This is a screen capture of the microSD file tree. I used the
The code looks like this:
services of the jEdit Programmer's Editor (free under the GNU
General Public License) to also show the contents of the files that
LATAbits.LATA3 = 1;
By the way, as you can see in Screenshot 1, it works.
There are three demos that you can choose from in
the MLA project skeleton. I’ve decided to run
Easy PIC32MX Bootloading
Demonstration1.c with the modifications to I/O pin RA3
I’ve shown you. If all goes as planned, the demo program
will build a directory tree that looks like this:
So, microSD cards are not restricted to storing data.
\ -> FILE1.TXT
-> ONE -> TWO -> THREE -> FILE3.TXT
-> FOUR -> FIVE -> SIX
We can take everything we’ve discussed thus far and
apply it to creating a microSD bootloader. To follow along,
download the Microchip application note AN1388 and
install the associated source code. Load up MPLAB X with
the SD_Card_Btl_Explorer16 project as shown in
A more easily understood directory tree is shown in
Obviously, we aren’t using an Explorer 16 dev board.
It doesn’t matter what the project is called, it’s what we
June 2015 77