Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hello all,
I am hoping to gain a little bit of clarity on how data is sent and stored on a SD card. I have managed to initialize the SD card and even write a predefined file using some example code (included below).
SAMPLE CODE WRITING FILE:
#define TEST_FILENAME "WSLOG.TXT"
FRESULT res; /* FatFs function common result code */
// write some info
FIL fsrc; /* File objects */
/* Open the file for append */
res = open_append(&fsrc, TEST_FILENAME);
if (res != FR_OK)
{
/* Error. Cannot create the file */
while (1);
}
// if file empty, write header
if (!f_size(&fsrc))
{
res = f_printf(&fsrc, "ADC Ouput Codes\n");
if (res < 0)
{
/* Error. Cannot write header */
while (1);
}
}
res = f_printf(&fsrc, "%08u\n", &value); //res is the actual line of data that we are storing on the SD card
if (res < FR_OK)
{
/* Error. Cannot log data */
while (1);
}
/* Close the file */
res = f_close(&fsrc);
if (res != FR_OK)
{
/* Error. Cannot close the file */
while (1);
}
My question is, do I send data using the mibspiTransfer() function available through HALCoGen; or do I have to use the the Write_Block SD card command?