Running the SD Card Demo

MDD File System Interface Library

MDDFS Interface Library Help
Running the SD Card Demo

The “MDD File System - SD Card” demo application supports PIC18, PIC24F, PIC24E, dsPIC33E and PIC32 architectures. The demo uses the selected hardware platform for data I/O operations with SD card through SPI channel. This demo shows how to create a file, write into the file, close the file, read from the file, rename the file, delete a file, create a directory, change the current working directory, delete the directory and it's contents, search a file in the directory...etc...etc.. in the SD card memory. The maximum length of any file or directory name is restricted to 255 characters (LFN format). The Long File Name (LFN) format is supported for only 16 and 32 bit PIC® microcontrollers. PIC18 microcontrollers doesn’t support LFN feature due to comparatively lesser RAM size. Whereas the basic 8.3 format filename is supported by all 8, 16 & 32 bit PIC® microcontrollers. All the project demos of “MDD File System - SD Card” have to be programmed & verified in debug mode of MPLAB IDE. 

After programming the appropriate firmware on the appropriate hardware platform, run the demo application till the last while(1) loop in the main() function. Remove the SD card from the SD Card PICTail™ Plus Daughter board and verify the final contents of the SD card in your Laptop or PC. The contents of the SD card should match the below file and directory structure. 

 

Note:

  1. Please open the corresponding "Demonstration .c" file to understand the flow of the source code thoroughly.
  2. "Demonstration.c" & "Demonstration1.c" files show the usage of File System API’s when the file & directory names are in 8.3 Format.
  3. "Demonstration2.c" file shows the usage of File System API’s when the file & directory names are in LFN Format.
  4. "Demonstration3.c" file shows the usage of File System API’s when the file & directory names are in UTF-16 bit Format.
 

For more details about SD card communication using MDD – File System Library, please refer AN1045 

 

Troubleshooting Tips: 

Issue 1: How to increase the speed of SD card read/write operation? 

Solution: The main bottleneck to increase the speed for SD card read/write operation is SPI clock frequency. In the released stack the SPI clock rate is set as 4 MHz. Please search for “OpenSPIM(SYNC_MODE_FAST)” in the stack. This function sets the SPI clock speed during the data transfers with the SD card. This function is called in “MDD_SDSPI_MediaInitialize()” function. If you want to increase the SPI clock rate for PIC18/PIC24F, modify the SYNC_MODE_FAST macro value. The maximum value of SPI clock frequency that can be set for PIC18/PIC24F microcontrollers is 8 MHz. 

For PIC32, modify the macro “SPI_FREQUENCY” to change the SPI clock rate for the data transfers. The maximum value of SPI clock frequency that can be set for PIC32 microcontrollers is 25 MHz. 

Please verify peripheral bus frequency, system clock frequency, SPI Baud Rate register values (SPI Baud Rate Calculation formula) and the corresponding PIC® microcontroller datasheet before modifying the macro “SYNC_MODE_FAST” or “SPI_FREQUENCY” in the source code.

Microchip MDD File System Interface 1.4.2 - [Oct 15, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.