Jump to content

[Energia Library] Stellaris Launchpad FatFs Energia library

Recommended Posts

Hi Calin,
I want to test FatFs lib on TIVA, it works with ENERGIA 0101E0009 but it returns error compiling with Energia 0101E0011:
UBUNTU 13.10 - energia 0101E0011- FatFsSpeedTest
---------------------------the error output -----------------------
/energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/fatfs.cpp: In member function 'FRESULT FFS::begin(unsigned char, uint8_t, uint8_t)':
/energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/fatfs.cpp:151:13: error: no matching function for call to 'SPIClass::begin(int)'
/energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/fatfs.cpp:151:13: note: candidate is:
In file included from /energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/fatfs.h:14:0,
                 from /energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/fatfs.cpp:13:
/energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/../SPI/SPI.h:42:8: note: void SPIClass::begin()
/energia/energia-0101E0011/hardware/lm4f/libraries/FatFs/../SPI/SPI.h:42:8: note:   candidate expects 0 arguments, 1 provided
If anybody knows the solution for this issue, please help.
Best wishes:



Link to post
Share on other sites
  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is a port to Energia of the Arduino library from this page: http://pressplay.pbworks.com/w/page/25687375/FatFs   The diskio.c driver is from Stellarisware example for lm4f232 with some changes:

I am afraid this wrapper doesn't have mentioned functionality. But normal FatFs library can. I use it with Energia without any problems. I use diskio.c from one of the StellarisWare examples, modified

@calinp - can You show a simplest example for log string data to file? (If file doesn't exist then create it, and append new data at the end - nothing else)   tnx!

Posted Images

Hi bkb,


I think this error is caused by these changes in the SPI library :https://github.com/energia/Energia/commit/4b5ebc4370afd426a41dfe3cc6bbaafbeb764f04

Try to edit fatfs.cpp at line 151 to replace  SPI.begin(9); with  SPI.begin();


I still use ENERGIA 0101E0009 but next year I will try this lib on ENERGIA 0101E00011 :)



Link to post
Share on other sites

Hi Calin!


Thank You for your reply, I can confirm, that my setup SPI(0) works with SPI library of Energia 0101E00011 modified line 151 

1. SPI.begin(9); -> replaced to  SPI.begin();


2. I've tested with SPI library from here ->  SPI_all_ports_LM4F.zip   and it works well too.


The setup is based on http://www.ti.com/lit/an/slaa281b/slaa281b.pdf

This is the shematic of the SD card connection.



Link to post
Share on other sites
  • 3 months later...

Thanks for the feed-back! Unfortunately, it's more complicated than that.


Line 152 should be 

#if defined(__LM4F120H5QR__) || defined(__TM4C1230C3PM__) || defined(__TM4C123GH6PM__) || defined(__TM4C129XNCZAD__) || defined(__TM4C1294NCPDT__)

because multiple names were used for the Stellaris / Tiva C Series TM4C123 LaunchPad and the Tiva C Series TM4C129 Connected LaunchPad.

Link to post
Share on other sites


I tried out fatfs from rei Vilos post #34 on my tiva TM4C123 launchpad.

The speedtest example runs without problems, but with "FileWritetoSerial" i get following error:


FileWriteToSerial.ino: In function 'void dir_list()': FileWriteToSerial.ino: 82:3: error: 'FILINFO' was not declared in this scope


Any hints?


Thank you!







Link to post
Share on other sites

FileWriteToSerial.ino: In function 'void dir_list()': FileWriteToSerial.ino: 82:3: error: 'FILINFO' was not declared in this scope


I've added the _t suffix to all types, so you need to edit line 82 and add the _t suffix to FILINFO to get FILINFO_t.

void dir_list (void) {
  FILINFO_t file_info;            // information on file size and type

Now, I'm no longer using the FatFs library but the SD library from Adafruit. It provides a higher level interface.

Link to post
Share on other sites
  • 1 month later...
  • 2 weeks later...

https://github.com/energia/Energia/tree/master/libraries/SD but maybe it´s an older version and only for the msp430.


Maybe you can really post your SD library (is it really for stellaris/tiva?), 


The MSP430G2 MCUs don't have enough RAM to handle the SD-card. SD-card in SPI more requires 512 bytes of RAM as buffer for cluster. So the library only works on a LM4F / TM4C.


Here's the ZIP file. Changes from the original library are minimal. However, the library seems to suffer from memory leakage. I don't have the tools to check and fix this.


Please note that, contrary to the other libraries I've released, I'm not providing any support for this FatFS library. You use it at your own risk.


Enjoy  :)


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.

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