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.

MSP430FR2355: SD card writing to USB0

Part Number: MSP430FR2355
Other Parts Discussed in Thread: MSP430F5529, MSP430FR5994

Hello...

I need to write csv style files to an SD/micro card.  The best I can find is a link in the following pdf:

How to Interface

(interesting enough clicking the link does not seem to work on Chrome....I had to cut and paste the URL to backdoor and get it (not sure if TI doesn't support this anymore)).

Anyway after looking at the code here I notice no file open or file close function calls exist in this code (or so I don't see them).  I am not terribly familiar with how to go about writing to the card but all the support on this seems to point to arduino folks and when watching "how to" videos and reading they all point to functions that open and close the file each time there is a write action.

Can anyone point me or tell me a little about the process for doing this task using the above mentioned micro-controller?

  • In MSP430USBDevelopersPackage ( https://www.ti.com/tool/MSP430USBDEVPACK ) based on MSP430F5529 with USB hardware module there are open source examples...

    Example #M1_FileSystemEmulation

    Example #M2_SDCardReader

    Your FR device is without USB hardware module but I guess that you can take interesting part of code related to SD card form there. Both MSP430F5529 and MSP430FR are with same CPUvX2.

  • There are two layers to what you are trying to do. The first is reading and writing the SD card. The MSP430 doesn't have a SD interface so you will have to use SPI. Not too difficult. Because you say you want to write a csv file that implies a file system. So you need code to handle whichever file system you choose.

    There are of course libraries out there to use. The file system code should be reasonably portable but the low level SPI stuff is not. Also, the file system code can be large if it supports all of the things you can do to a file system. If your needs are simpler, you can write smaller programs that do only what you need. I have done that for a data logger where all I needed to do was read a configuration file (once) and then write data. No fancy file open/close functions or directory support.

  • "There are of course libraries out there to use"

    Can you point me to such libraries?  I have not found anything (now granted I am new to this)....

    The end application is to log some sensor data and some gps data....I have no need to read from the MSP430....Strictly open, write/append and close.   I will be using the SPI bus as you mentioned.  My vision (at the moment) is that the file system will be configured onto the card prior to it being placed into the card reader/writer slot.  Seems like I should just be able to use stdint.h with fopen, fprintf, etc???

  • The fuctions fopen() etc. depend on support from an operating system like Unix. The MSP430 has nothing like that so they are useless. You have to provide those functions.

    I haven't looked for a FAT library in a long time. The last time I looked at one I was horrified by how inefficient it was. They should be better now. My first effort was based on the SparkFun Logomatic. http://davesrocketworks.com/electronics/logOmatic/index.html Lots of code there but it is FAT16 which was sufficient at the time but not for the GB SD cards of today.

  • Good information....

    Thank you!  Don't know much on the subject so just digging in.....

  • Hi,

    There is a SD card demo project with MSP430FR5994. You can take it as reference for the FR2355. 

    https://dev.ti.com/tirex/explore/node?node=A__ALBhfl55ewg.hLTVI74EAQ__msp430ware__IOGqZri__LATEST&placeholder=true

    Best regards,

    Cash Hao

**Attention** This is a public forum