This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: storing files on external flash and TI RTOS.

Part Number: TM4C1294NCPDT

Tool/software:

I am using the following: CCS 8.3.0, TIRTOS 2.16.1.14, compiler 5.2.7, XDC 3.31.1333, TM4C1294NCPDT, ndk_2_25_00_09

 

Currently I have code that can read and write a small external flash chip using a single SPI on the Tiva.  I can send and receive the data to and from the small flash via TFTP to and from a remote system so I have a functional implementation.   The small flash holds 2 different files of known size and type and the memory is pre partitioned according to the expected sizes of the two expected files.  Example: file1.txt is max 400k in size and file2.bin is 5 Meg so the flash is partitioned to allocate say 500K for the first file and 6Meg for the second file.  This may not be ideal, but it works and meets the needs.

I am adding a large 1G Byte flash chip to a single channel SPI channel (SPI channel 3) on the Tiva for more external storage.  It would be nice to use 4 channel SPI but the pins that would be used for the other 3 channels are currently used on the Tiva so using 4 channel SPI is not a option.

I am considering if there is the better way to implement a small lightweight file system for external flash memory but since the Tiva is a small micro with limited resources, I don’t want to implement something that’s going to consume all the RAM and flash space in the Tiva for the firmware.  I do have code I can reuse as described above that can send and receive using TFTP.   I can pre allocate the 1G Byte flash space like I did with the small flash by pre defining for example 10 sections in the 1GByte flash and I can only have up to 10 files. 

The long term plan for the flash is we only need to add a few more files but a few files may be 35Meg each in size so it is never expected to ever have many small files of varying sizes so pre partition would probably be fine but it would limit the flexibility long term. 

Is there a better way I should consider implement this?

I see that TI RTOS has a RAM disk but I don’t know if there is anything else in the TI RTOS I should be considering for flash or if there is a better approach I should be using?

Thanks,

Doug

  • Hi Doug,

    I am considering if there is the better way to implement a small lightweight file system for external flash memory but since the Tiva is a small micro with limited resources, I don’t want to implement something that’s going to consume all the RAM and flash space in the Tiva for the firmware.  I do have code I can reuse as described above that can send and receive using TFTP. 

    If you are looking for a FATFS driver then TI-RTOS has incorporated the open source FATFS into its SYS/BIOS kernel.  There are two examples you can find. Please see below. 

    If this is not what you are looking for, then I'm not really clear as to what you mean by better way to implement a solution. 

  • I think these examples use a SD card interface and the flash we are adding to the board is a SPI NAND SPI interface to the flash.  With the SPI NAND device connected directly to the Tiva through a single channel SPI, I have the basic read / write / erase operations working but I didn't know if the TI-RTOS offered anything I could use to implement a file system on the SPI NAND flash chip we are adding similar to the examples you referred.   That said, I do have limited code space and RAM so any implementation would need to consider the Tiva resources needed to implement the solution.

  • g but I didn't know if the TI-RTOS offered anything I could use to implement a file system on the SPI NAND flash chip we are adding similar to the examples you referred. 

    Hi Doug,

      We don't have any TI-RTOS example using a file system for SPI Flash. You are right that the existing example is for SDcard. However, the example is based on the SD memory that also uses SPI interface. I suppose with some modification, the file system can be ported to SPI flash. 

    That said, I do have limited code space and RAM so any implementation would need to consider the Tiva resources needed to implement the solution.

    You might want to look at the file system example for SD card and see how much space the FATFS library takes up and compare with how much you current application has taken on the internal flash and ram. If what you have left is smaller than how much the FATFS library is going to need then there is no head room.