Secure Digital SD Card Source Code Driver Project
Section 03. Using The Sample Projects

03. Using The Sample Projects

a) Sample Projects Included

Sample projects are included with the driver for specific devices and compilers. The example schematics at the end of this manual detail the circuit each sample project is designed to work with. You may use the sample projects with the circuit shown or if desired use them as a starting block for your own project with a different device of compiler. To use them copy all of the files in the chosen sample project directory into the same directory as the driver files and then open and run using the development environment / compiler the project was designed with.

Rowley CrossWorks Compiler for ARM

Compiler:

Rowley Associates CrossWorks 2 C Compiler for ARM

Device:

NXP LPC2365

Microchip C18 Compiler

Compiler:

Microchip C18 MPLAB C Compiler for PIC18 family of 8 bit microcontrollers

Device:

PIC18F4620

Notes:

The C18 project uses a modified version off the Microchip standard linker script for the PIC18F4620. This is required as the C18 compiler does not support data buffers over 256 bytes without a modification to the linker script to define a larger bank of microcontroller ram. A 512 byte buffer is required by the driver. You will see in the sample linker script that 2 consecutive gpr banks have been removed and instead replaced with:-

DATABANK NAME=ffs_512_byte_ram_section START=0x#00 END=0x#FF

where ‘0x#00’ is the start address of the first removed bank and ‘0x#FF ‘ is the end address of the second removed bank. If modifying other device linker scripts ensure that you also check the bank used by the stack and change it to another bank if it conflicts.

Microchip C30 Compiler

Compiler:

Microchip C30 MPLAB C Compiler for PIC24 family of 16 bit microcontrollers and dsPIC digital signal controllers

Device:

PIC24HJ64GP206

b) Sample Project Functions

When run the 2 LED’s operate as follows:-

Red LED indicates that PCB is powered up but no card is detected

When a card is inserted and has been detected the red LED goes off and the green LED lights.

When the switch is pressed the following occurs:

All files in the root directory are deleted

A new text file called test.txt is created containing example test data.

A new Excel compatible spreadsheet file called test.csv is created containing test data from the test.txt file.

When the file operations have been completed the green LED goes off.

If there is a file operation error both LED’s will light.