I am working with a custom K60 120MHz board we designed that uses the same NAND FLASH as the K60F120M tower board. I added the NAND Flash File system patch to MQX 4.0 and I was able to get the NAND working and can read and write to it. I then added the web server that come with MQX. Now both the web server and the NAND drive work correctly, but will not operate together. I also enable the shell to allow manual control of the initialization. The problem I have Is memory, specifically RAM. If I start my firmware with the NAND uninitialized the web server works correctly. Once I initialize/open the NAND Flash drive, the webserver can no longer allocate enough memory for the RX and TX buffers and stops working. If I close the NAND drive the web server recovers and works correctly. Since the documentation for the NAND Flash file system patch does not explain how the buffer management is handled and configured I can not easily resolve this issue. Is there an unreleased document that can be made available that may speed my understanding of the NAND Flash driver and wear leveling code to save me from reading all the source files and figuring this out myself? Also can the wear leveling code be disabled? My application will not be writing tot he NAND very often so I would be willing to sacrifice wear leveling if it will save me RAM.
Thanks,
Frank
已解决! 转到解答。
Please check your NUM_OF_MAX_SIZE_NS_SECTORS_MAPS setting, by default, it is 128, and thus this will consume NUM_OF_MAX_SIZE_NS_SECTORS_MAPS* (NSSM_BASE_PAGE_PER_BLOCK_COUNT /NumSectorsPerBlock)*sizeof(map_entry)*2 = 128 * 4 * 48 * 2 = 48K memory. Please change it to 9, then about 40K mem can be saved.
Hi Frank,
There exists a demo:
\mqx\examples\nandflash\nandflash_demo.c
It shows how to use nand flash driver to read and write data in block mode (512 bytes) without wear leveling layer.
I can imagine a custom load mechanism can be implemented to write TFS data into NAND flash and then customize TFS low level read and write functions to call NAND flash read and write functions, with some sort of simple caching mechanism for 512 bytes.
I'm sorry I don't have experience with FFS much so I can't advice about its memory consumption at the moment.
K70 has possibility to interface a large SDRAM, this might be also an option.
Hi Martin,
Thanks for the reply but I need to have MFS on top of the NAND driver. My goal is to have the HTTP server retrieve it's data from the NAND drive. I also plan on enabling the FTP server to allow the web page files to be updated. Once I get the memory issue resolved I intend to remove the TFS from the server code I am currently using and sever the pages from the NAND drive.
Thanks for pointing me to the nandflach_demo under the MQX examples. I did not notice that example as I was looking at the FFS example which looks like it has wear leveling enabled. I am going to try to disable wear leveling to see if that helps with the memory allocation problem I am experiencing.
Please check your NUM_OF_MAX_SIZE_NS_SECTORS_MAPS setting, by default, it is 128, and thus this will consume NUM_OF_MAX_SIZE_NS_SECTORS_MAPS* (NSSM_BASE_PAGE_PER_BLOCK_COUNT /NumSectorsPerBlock)*sizeof(map_entry)*2 = 128 * 4 * 48 * 2 = 48K memory. Please change it to 9, then about 40K mem can be saved.