Jump to content
bluehash

PetiteFS FATfs SDCard USCI code

Recommended Posts

Thanks Bluehash.

Now I have a question of using concurrently the HW serial port on MSP2553 (along with Software Serial port):

* One for talking to PC

* Other for integrating to other MCU/Serial-Device (like GPS receiver)

 

It seems that ports used for RX/TX are linked to PC via USB-driver (P1.1 TXD, P1.2 RXD). Software_Serial uses same ports.

Is it possible to remap/change these ports, so that I can have two serial ports (one with PC and other with MCU) simultaneously?

 

regards

 

mahadevan

Share this post


Link to post
Share on other sites

Sorry for not fully understanding this,

What types of SD cards can this be used with? Can it be used with any SD card? Also, for file types on the PC, say I want to store a data string of integers that would correspond to music that could be sent to a DAC, what type of windows file type would I use?

Share this post


Link to post
Share on other sites

I downloaded this code and uploaded it to my MSP430G2553. The program loads fine but whenever I try to use the termite console that you used I can't elicit a response from the board. I enter the same commands you entered in the terminal and nothing happens. The terminal says the board is connected and I can't find any serious issues. I am currently using termite version 2.9. Can you think of any issues that would prevent communication from the boar to the terminal?

Share this post


Link to post
Share on other sites

- What's your Baud Rate?

- Are your RX/TX jumpers on the LP jumpered?

- Make sure termits sends a CRLF when you press enter. The board should respond with >

 

I have the boards ready for shipment if anyone wants it. I've sent a board to Rickta59 to get the "sdcard write" to work. If anyone is interested in the boards, let me know. Price is $8/board assembled.

Share this post


Link to post
Share on other sites

Thank you very much. I managed to get the device up and running.

 

I was looking to modify this code to allow me to write data to the sd card and store it there until I decide to retrieve it without using the console at all. I would like to write a program that can write data from the sd card to a specific address in the card's memory until I decide to retrieve it, again using only the board and not the console. I have tried using the example given by TI but I think it has a few bugs, What I'm essentially looking for is a high level function that will allow me to write to and read from the sd card. Can you point me in the right direction in achieving this goal.

Share this post


Link to post
Share on other sites

Currently the code does not support write. I've sent a boosterpack to Ricta and he'll be working on it.

 

The only caveat with petiteFatFs is that you have to create a file on a PC. Once created the MSP will be able to write to it.

 

Function will be high level. In fact, you can just pick it up from the command line part of the code.

Share this post


Link to post
Share on other sites
Currently the code does not support write. I've sent a boosterpack to Rickta59 and he'll be working on it.

 

I went ahead and tested the booster pack and added the write support in the attached zip file. You should take a look at the Petit FatFS documentation regarding the write limitations. PetiteFS only supports writing to preexisting files and you can't grow or shrink the size of the file.

 

For the example code to work, create a file called 'write.txt' on your sdcard. The example writes 100 lines of quick brown fox type text to the file. At the command prompt type

 

> di

> fi

> fl

 

Make sure you can see the file 'WRITE.TXT' in the listing. To write to the file type:

 

> fw

 

To see if it worked type:

 

> fo WRITE.TXT

> ft

 

You should see numbered lines of quick brown fox...

 

-rick

SDCARD_PetiteFS_2553_v0.02.zip

Share this post


Link to post
Share on other sites

I have just tested the latest Code (v0.02) with ccs5 and it worked perfect from the srcatch! :thumbup:

 

Thank you very much for that! Great work, nice code, even for a beginner like me. :thumbup:

 

 

I still have one Question:

Is there an opportunity to append data to an existing file which contains already written data?

 

I would like to use the LaunchPad as a data logger, saving my data (only some bytes each time) only every 15 minutes. The logger should work over some month. Therefor I would like to savely close the file after appending my data and waiting 14.9 minutes. Just in case something goes wrong in the meanwhile. How can this be done?

 

Some ideas:

do I have to remember the last position of writing?

or if I don't know it (after Reset) have to read out the file to know where to move my writing pointer

might pf_lseek(); be usefull?

 

Again, Thank you very much!! Great work!! :thumbup:

 

Cheers Johannes

Share this post


Link to post
Share on other sites

Yes you can use pf_lseek to move the position before writing. Remember to make the file large

enough to hold all your samples. You could write the length of the file someplace and then seek there.

 

Maybe a real time clock would help. Use the julian date and timestamp as an offset into the file.

On a pc, write the log file with an empty entry for every expected log entry and then just

overwrite that data with the real sample.

 

-rick

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...