This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430-5510STK writing to SD card with FatFs

As the subject states; I have an MSP430-5510STK dev board.

There is an SD card reader on the board which I am writing to using FatFs.

Everything works ok except that when I create a new file in any directory (even root) and there are no other files in that directory then it takes about a minute to write to the file. However if I run the exact same programme that creates a new file in the same directory but there is already a file in there under a different name then the new file is written to in a matter of seconds.

Has else anyone come across this problem?

Thanks,
Callum

  • Callum,

    since this board is made by our third party (and also the software), I don't think there are many people here have tested it. However, I believe you can try to compare it with the implementation of MSP-EXP430F5529 software: 

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPEXP430F5529UE/latest/index_FDS.html

    since it also has SD card interface and uses FatFs file system.

  • Hi Leo,

    Thank you for your reply. As it turned out the error was caused by Windows; I had files on there that were created on Windows and so they used the Long filename feature but I had this disabled in FatFs and due to the way FAT works the original filenames were still stored even though I changed them to Short filenames.

    This meant that when my programme accessed the volume, it was confused by the extra data from Long filenames and caused delays.

    Callum

  • i am trying to interface mmc card with cc430 using fat file system. can u give me a sample code to log data in sd card in fat file system. so that it could see in PC.
    Thanks
  • If you have a FAT file system driver compiled into your project, then you can use the same fopen/fprintf functions you have in Windows. What you write to which file (and what it means) is your choice.
  • I am trying to develop your FAT16 code in CC430. i just interface with my controller and data has been logged successfully. thanks for your work.
    i can log my data only once. i need to log my data continuously in a text file. i am using fat16 code developed by santos .

    since i am just starting level to study fat library,i do not know where to modify your fat_write() function.

    Thank You
  • The code you are using isn't 'my' code. In fact, I don't know which code you are using and what it can do and can't do.
    A typical file system implementation provides support for the standard C functions fopen, fwrite, fprintf etc. There you can open a file for appending data, seek data, or sequentially read or write from to to a file.
    It seems you have a write function that saves a fixed amount of data into a file, which is a high-level function like "save as". If you want to append data or write a continuous data stream (until the card is full), then you need to go a step back and use the C library stream functions. Something like

    FILE * myfile;
    myfile = fopen (name, flags);
    fwrite(myfile,data);
    ...
    fprintf(myfile,"%d", value);
    fclose(myfile);
    Of course these functions need to be supported (means: provided) by your file system driver.

    It may be possible to split your existing fat_write() function into its three parts open, write data and close, and call the write data part multiple times. However, this is something of the type "if you have to ask how to do it, then it's likely something you shouldn't try".
  • hi,
    i'm trying to log data in a sd card using an msp430 and fatfs, please can you send me an exemple of code, the problem is that i don't know how to modify the diskio.c , i know that we should not modify the ff.c code.

**Attention** This is a public forum