sdcard  1.5
Customations for HvA-Xmegaboard to SD-card library FatFs of Chan
sdcard_test_sdmm.c File Reference

Test program for sd-card with Chan FatFS and customized sdmm.c. More...

#include <avr/interrupt.h>
#include "clock/clock.h"
#include "serialF0/serialF0.h"

Macros

#define F_CPU   32000000UL
 

Functions

int demo_ff (void)
 Demonstration. It writes text to a file on the SD-card. After that it reads the file from the SD-card and print the text. This example is code D.2 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega' More...
 
int main (void)
 main routine for testing sdmm.c More...
 

Detailed Description

Test program for sd-card with Chan FatFS and customized sdmm.c.

Author
Wim Dolman (w.e.dolman@hva.nl)
Date
11-03-2020
Version
1.5

Usage with Atmel Studio.
This example uses the serialF0, see https://dolman-wim.nl/xmega/libraries/online/serialF0/html/index.html and the clock functions, see https://dolman-wim.nl/xmega/libraries/online/clock/html/index.html In the project directory uses three subfolders: clock, ff, and serialF0.

  1. Make an Atmel Studio project
  2. Add three subfolders (use New Folder...) to the project : clock, ff, and serialF0
  3. Place the necessary files in the Atmel Studio project folder/subfolders
    clock/clock.c Clock functions
    clock/clock.h Clock functions
    serialF0/serialF0.c Serial interface
    serialF0/serialF0.h Serial interface
    ff/ff.c Latest version from Chan's Library
    ff/ff.h Latest version from Chan's Library
    ff/ffconf.h Latest version from Chan's Library
    ff/ sdmm.c Customized version Chan's Sample generic release 11a
    sdcard_test_sdmm.c This example
    demo_ff.c function with demo SD-card
  4. Add all c-files to the project
  5. Change the four defines in ffconf.h
               #define FF_USE_STRFUNC  2
               #define FF_USE_CHMO     1
               #define FF_FS_NORTC     1
               #define FF_USE_LFN      0 

You can place the library files also directly in the project folder or in an other folder. In that case you need to change the path in the #include lines.

This test program is based on the example D.1 and D.2 from 'De taal C en de Xmega' 2nd edition.

Macro Definition Documentation

◆ F_CPU

#define F_CPU   32000000UL

Function Documentation

◆ demo_ff()

int demo_ff ( void  )

Demonstration. It writes text to a file on the SD-card. After that it reads the file from the SD-card and print the text. This example is code D.2 from 'De taal C en de Xmega' second edition, see Voorbeelden uit 'De taal C en de Xmega'

Returns
void

◆ main()

int main ( void  )

main routine for testing sdmm.c

It initialize the clock, the streams, set the global interrupts and run the demo program once.

Returns
int