Jump to content
uberscientist

FatFS on MSP430G2744

Recommended Posts

I was looking to interface FatFS to the MSP430G2744:

 

It has 1KB of ram (may be enough?  If not I might look into using the MSP430G2755 with 4KB of ram)

 

I've been hacking away at getting it interfaced after doing Petit FatFS and realizing I needed to have resizable files and file creation (oops).... and that Petit has already been ported (double oops).

 

I've been able to get it to compile with GCC, here's the FatFS branch of the project.

 

But things are not running smoothly anymore, after I upload the code the LEDs are dim and it doesn't seem to execute past my little serial logging solution (in com.c)

 

I've taken a break for about a week and just started looking back into this, I'm feeling sort of lost at the moment, I'm not very good at low level debugging with the open source tools.

 

Thanks for any ideas,

Chris

Share this post


Link to post
Share on other sites

I used fatFS on one of my very first MSP430 projects.

 

From memory I was having a hard time until I enabled the 'packed structs' gcc option.

gcc was trying to space out my RAM to make accesses word aligned and quicker, but that broke stuff inside the library, as it needs to maintain the exact structure when writing to the filesystem.

 

Also, I might be wrong. but I think TI's ez430f5529 ( http://www.ti.com/tool/msp-exp430f5529 ) used fatFS in it's example code.

Share this post


Link to post
Share on other sites

Just a reminder: in addition to a 43oh FatFS port that I believe @@bluehash has made available somewhere around here, I maintain a github repository that tracks all releases of FatFS and Petit FatFS and the sample code, including patches, updated whenever I happen to remember. This may be useful to people who want to see how it changes over time, since ChaN only publishes packaged releases. (For example, R0.10 introduced an API change to f_mount.)

 

BSP430 has an example fatfs interface that may also be useful, as the FatFS sample package dropped the generic example back in 2013.

Share this post


Link to post
Share on other sites

Thanks for the links and words, I'll just give a progress update...

 

I've been able to mount the FAT32 SD card, but as soon as I try to use the f_open(...) function I get that buggy behaviour I was talking about in my original post:

 

Dim LED if I turn the GPIO pin high before calling f_open, or the LED doesn't even turn on if I place it after f_open.  It is flickering on/off very quickly so I figure the MSP430 is cycling on/off very rapidly due to the compiler creating an .elf file that is doing something screwy.

 

Oh well, I might just ditch the FatFS idea and just use the SD card as raw flash memory like I was doing before all these shenanigans.

Share this post


Link to post
Share on other sites

I finally got a MSP430G2755 -- and it worked!  I guess 1KB RAM is just not enough for the full FatFS, PetitFS seemed to work fine fwiw.

 

I had to remove the 

-Wl,--gc-sections

line from the linker options, but after that it worked.

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...