Example Summary

Example to read and write data onto an SD Card with a FAT file system.

Peripherals & Pin Assignments

When this project is built, the SysConfig tool will generate the TI-Driver configurations into the ti_drivers_config.c and ti_drivers_config.h files. Information on pins and resources used is present in both generated files. Additionally, the System Configuration file (*.syscfg) present in the project may be opened with SysConfig’s graphical user interface to determine pins and resources used.

BoosterPacks, Board Resources & Jumper Settings

This example requires a BOOSTXL-SHARP128 LCD & SD Card BoosterPack.

For board specific jumper settings, resources and BoosterPack modifications, refer to the Board.html file.

If you’re using an IDE such as Code Composer Studio (CCS) or IAR, please refer to Board.html in your project directory for resources used and board-specific jumper settings.

The Board.html can also be found in your SDK installation:

<SDK_INSTALL_DIR>/source/ti/boards/<BOARD>

Example Usage

The connection will have the following settings:

    Baud-rate:     115200
    Data bits:          8
    Stop bits:          1
    Parity:          None
    Flow Control:    None
    "***********************************************************************\n"
    "0         1         2         3         4         5         6         7\n"
    "01234567890123456789012345678901234567890123456789012345678901234567890\n"
    "This is some text to be inserted into the inputfile if there isn't     \n"
    "already an existing file located on the SDCard.                        \n"
    "If an inputfile already exists, or if the file was already once        \n"
    "generated, then the inputfile will NOT be modified.                    \n"
    "***********************************************************************\n"

Application Design Details

This application uses one thread:

The mainThread performs the following actions:

  1. Create and initialize the SDFatFS driver object.

  2. Print the disk size and the amount of free space on it.

  3. Open the input.txt file. If not found, create the file for reading and writing. Write the default message to the file.

  4. Open the output.txt file. Content will be overwritten if found.

  5. Copy the contents of input.txt to output.txt. Closes both files afterwards.

  6. Open output.txt, read the file, print the contents to the display and close output.txt.

  7. Print the disk size and the amount of free space on it. If the disk was empty, the difference in free space can be observed.

  8. Close the SDFatFS driver and terminate the example.

TI-RTOS

FreeRTOS

NORTOS

References