Is it possible to use MFS in an external flash memory?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to use MFS in an external flash memory?

1,928 Views
MQXuser
Contributor III

I am looking forward to store web pages into an external flash memory (AT45DB161D-TU) wich is connected to a SPI port into the MCF52259.

Problem is I dont know where to start in order to do this as clean as I can possibly do.

I dont know how to format my data in order to retrieve it in a convinient way.
I also would like this to be flexible(not to have specific sizes) and that is
the reason I am thinking about using the MFS.

 

Any ideas are welcome, also let me know  if there is a documentation I should read in order to solve this.

0 Kudos
Reply
3 Replies

855 Views
JKadin
Contributor II

This was posted a long time ago, did you ever get it working, I am trying to do the same thing with a bigger flash, an example would help me.

0 Kudos
Reply

855 Views
MikeRC
Contributor III

If it is something that needs to be written often, MFS is not a viable solution.  Due to the nature of external NOR Flash like the Atmel chip on the TWR-MEM board, whenever you have to write to a file with MFS, you have to erase it first.  So every write requires that you read a block of memory out to RAM, modify it, erase the block on the Flash chip, then write from your RAM copy to the Flash chip.  There is a lot of latency there, and if you need to constantly modify files, or you are going to write to them enough to reach the maximum suggested erase/write cycles (100K), then you probably don't want to attach MFS to NOR Flash.

 

If it is something that you aren't going to write to often (you can read it as much as you want without wearing it out), then this topic can get you started:

https://community.freescale.com/message/68894#68894

 

Also, as written in the above post, Embedded Access does have a Flash File System for sale.  I don't know how much it costs, but I would assume that it is a file system similar to MFS that is targeted for NOR FLASH.

 

I hope that helps. If you have any more questions I can do my best to answer them.  I went through a similar process a couple months ago.

0 Kudos
Reply

855 Views
PavelM
NXP Employee
NXP Employee

It is possible to use MFS in flash memory. You need to write low level flash driver with functions for data write and sector erase and define flash memory map. See any flash driver in MQX (flashx directory). Differences will be usage of SPI, we using flexbus in examples. The flash initialization you can find in bsp directory, file init_flash.c. To init function put the SPI initialization. Example of SPI access you can find in mqx/examples/spi demo. For proper low level driver function test you can modify the flashx demo.

If driver is OK, modify MFS ramdisk demo, open your flash device and install MFS on it.

 

In example: 

dev_handle1 = fopen("flashx:", NULL);

mqx_status = _io_mfs_install(dev_handle1, "a:", (_file_size)0);

0 Kudos
Reply