Files | |
file | fram.h |
FRAM Module for reading and writing from and to the FRAM. |
If you use the FRAM routines, you must call FRAMInit() once prior to use. This sets up the SPI parameters and IO pin directions.
As-is, the code supports hardware SPI relevant for the SBC65EC. If for some reason you need a software SPI, there is an option on line 28 of FRAM.c which will cause a software implementation to be used. Also, the particular io pins are configured in the subsequent section if you are using a non-standard connection. Lastly, the clock speed may be changed at line 53. For the slower FM25640 you will need SPI_FOSC_16, and for the faster FM25656 the default of SPI_FOSC_4 will work.
There are some additional sequential read and write routines. These were provided to ease porting of the file system and probably are of limited use otherwise. They leave the read or write transaction open so that multiple calls may be made to sequential addresses. There is a caveat that FRAMEndWrite()/FRAMEndRead() must be called before relinquishing control back to the system because the ethernet controller shares the same IO pins. This is a little different than is with EE since those pins are dedicated.
For testing I created a page experi.htm. This page is rewritten periodically and updated with the current tick count. This allowed me to easily see that file writing was working (in real life you would use cgi variables -- it was only a test).
Some modifications were made to the project to coax it into using fsFRAM instead of fsee. The most interesting changes were made in mxwebsrvr.c, which is where the 'test suite' is executed. Modifications in that file include:
Modifications can be found by searching for the comment marker HHH.
The embedded file system on which fsee (and hence fsFRAM) are based is very simple, and several limitations are imposed by it's design:
Despite it's limitations, fsee is fine for an embedded file system. I might implement a new file system with dynamic allocation, though it seems a bit much considering there is only 8-32k space to manage anyway.