Getting started with Atmel SAM4S-EK2

SD card

Initialize the driver

sd_mmc_init();
status = sd_mmc_test_unit_ready(0);

checks for the status of the memory port

res = f_mount(LUN_ID_SD_MMC_0_MEM, &fs);

mounts the memory card.

res = f_open(&file_object,
                (char const *)test_file_name,
                FA_CREATE_ALWAYS | FA_WRITE);

creates and open the file.

f_puts("Test SD/MMC stack\n", &file_object)

writes into the file.

f_close(&file_object);

closes the file object

f_gets (TCHAR* buff, int len,FIL* fil)

to read from file

For more information about memory, click here