■ SCHEMATIC 6. The PIC32MX795F512L contains all of the USB interface
circuitry. All that we need to supply are the physical connectors. If our chipKIT
Max32 is to act in the USB host capacity, throw in a switchable + 5.0 volt power
source with those connectors.
Here’s the heart of the application:
//Opening a file in mode “w” will create the file if it
// doesn’t exist. If the file does exist it will delete
// the old file and create a new one that is blank.
myFile = FSfopen(“test.txt”,”w”);
//Write some data to the new file.
FSfwrite(“Bringing Arduino to the PIC32MX with chipKIT
//Always make sure to close the file so that the data gets
// written to the drive.
My contribution to the Mass Storage application is rather obvious. Before compiling
the Application Libraries thumb drive code, I set the USB host power jumper to
feed the larger Type A USB connector on the Network Shield and plugged the Shield
into the Max32. I used the Max32’s Mini-B USB portal to power the Max32/Network
Shield combination from my laptop’s USB portal. Next, I opened the Mass Storage
application with MPLAB, attached a PICkit3 to the Max32, and compiled the
thumb drive application using Microchip’s C32 C compiler. The Application Libraries
Mass Storage application is bare bones and doesn’t give any indication that it is
working or not. However, when I attached the thumb drive to the Network Shield’s
Type A USB connector, the thumb drive’s activity LED began to blink. After a
few moments, the thumb drive’s activity LED ceased to blink and remained
illuminated. So, I detached the thumb drive and inserted it into my laptop’s USB
portal. Sure enough, there was a file created on the thumb drive called test.txt. I
opened test.txt with a text editor application to find that the file contained the
following: Bringing Arduino to the PIC32MX with chipKIT Max32. Enough said.
MORE chipKIT Max32 ARDUINO STUFF
We’ve shown the Max32 and Network Shield for what they are: excellent
development tools for both Arduino and native 32-bit PIC32MX applications. If you’ve
been on the fence about a Microchip presence in AVR land, check out the chipKIT
Max32 forums. I think you’ll be pleasantly surprised. You can access the chipKIT
forums and purchase your Max32 equipment from the Digilent website (www.
Meanwhile, I’ve got some Arduino-to-chipKIT Max32 porting to do! NV
October 2011 61