Jump to content
calinp

[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:
bkb

post-1372-14264605340946_thumb.png

post-1372-1426460534061_thumb.png

Share this post


Link to post
Share on other sites

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 :)

 

Calin

Share this post


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.

post-1372-14264605346642_thumb.png

bkb

Share this post


Link to post
Share on other sites

Please find the FATFS library with some improvements:

  • all the types have a _t suffix
FATFS_t FFS_t::fatfs_obj;	/* Working copy of FATFS_t */
  • wider range of MCUs supported
#if defined(__LM4F120H5QR__) || defined(__TM4C1230C3PM__) || defined(__TM4C129XNCZAD__)

Enjoy!

FatFs.zip

Share this post


Link to post
Share on other sites

Hi all

 

@rei

it lacks the definition for TIVA 1249NCPDT line 152 of file fatfss.cpp for the last attached zip file.

JC

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Hello,

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!

 

regards

Matthias

 

 

 

Share this post


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.

Share this post


Link to post
Share on other sites

Thank you for your fast answer! Now, it´s working, maybe I give the adafruit library a try, but I only need some basic file I/O for saving and restoring midi data/presets.

Edited by madias

Share this post


Link to post
Share on other sites

@@Rei Vilo:

Maybe you can really post your SD library (is it really for stellaris/tiva?), I see a lot of things to do with the original one, so you can save much work for  Thorvard and me :)

 

Thank you 

Regards 

Matthias

Share this post


Link to post
Share on other sites

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  :)

FatFs.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×