I have been searching for a FatFs Energia library for the FR5969 a while and haven't come across anything that worked, so I decided to try make one. If there is one out there.... ahhhhhhhhhhghhghgh.
The library is called Jaffl: Just another FatFs library
It is located at: https://github.com/geometrikal/Jaffl
It is written for the MSP430FR5969, mainly because transmit and receive SPI bytes routines hard coded to USCB0. If someone can make this more generic it would be welcome.
The Jaffl wrapper is based on the FatFs wrapper by David Sirkin.
The latest FatFs version (ff11) is used, but not all functions may have made it to the wrapper.
The diskio.c MMC interface comes from the TI example code for the MSP430F5529 LaunchPad with a few changes: 1. there were extra functions added to attach the SPI init / change speed / cs routines. 2. Class 6 and 10 cards weren't initialising, so instead of sending CMD0 once before failing (during disk_initialization()) it keeps sending every 1ms until it gets the right response, or one second has passed.
f_printf was changed to f_vprintf in ff.c and modified to accept va_list instead of the normal variable argument designator (the dots: ...) . This is because Jaffl.printf wraps it, and needs to pass the variable arguments as va_list.
A quick test example:
int counter = 0;
Serial.print("Begin, return code: ");
Serial.print("Open file, return code: ");
Serial.println(Jaffl.open("test.txt", FA_WRITE | FA_CREATE_ALWAYS));
Serial.print("Print file, return code: ");
Serial.println(Jaffl.printf("Hello world: %d\r\n", counter++));
Serial.print("Sync, return code: ");
The code isn't polished, but seems to work. I will be doing on going testing as this will be used in another project, but I've put it up now to get feedback and help spot bugs. 99% of the code came from other sources so thanks to those people. Its all on github so if you have changes do a pull request.
2015-03-18 - Added MISO internal pull up to get some cards to work.