We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all. I'm trying to mount file system on NAND flash MT29F1G08ABADAH4. I'm using cortex m4. Here are my NAND setting:
#define NAND0_ENABLE 1 #define NAND0_TYPE 0 #define NAND0_DRIVER 0 #define NAND0_DEV_NUM 0 #define NAND0_PAGE_SIZE 2112 #define NAND0_PAGE_COUNT 64 #define NAND0_BLOCK_COUNT 1024 // 128Mb #define NAND0_PAGE_CACHE 8 #define NAND0_BLOCK_CACHE 16 #define NAND0_SW_ECC 1 #define NAND0_CACHE_SIZE 4 #define NAND0_CACHE_RELOC 0 #define NAND0_CACHE_ADDR 0x80000000 #define NAND0_FAT_JOURNAL 1 #define NAND0_DEFAULT_DRIVE 1
I've tried to use example from MDK 5.0:File System Component:System Routines:fmount:
void main (void) {
if (finit ("N:") != fsOK) {// error handling} if (fmount ("N:") != fsOK) {// error handling} // do smth funmount ("M:"); funinit ("M:"); }
So, i've got a problem: finit("N0:") returnk OK, but fmount("N0:") fails with "fsMediaError" code
Can anybody help me?
Hi! I have the same problem. Did you find any way to resolve it?
It seems that the problem is in incorrect base, ALE and CLE addresses in NAND Mem bus config module. I've found in datasheets that CLE connected to PTD[8], ALE to PTD[9]. I cannot understand just one thing: what is the "base address" means: is it base address NFC, base address of PORTD or base address of GPIO at all? Now my config looks like a:
#define NAND_DEV0_ADDR_BASE 0x400A8000 #define NAND_DEV0_ADDR_ALE 0x400FF0E0 #define NAND_DEV0_ADDR_CLE 0x400FF0E4
Perhaps stating the processor/chip implementation you're using, and citing some documentation might assist others providing you with some insight?
Do have the external bus configured, and clocked correctly?
Can you access/probe the NAND device, and say get an ID out of it independently of the MDK code? Have you validated the NAND and external bus interface?
Thanks a lot, I've read most of links you gave before asking the question. Problem is that Keil made new MDK, 5.*, and low-and-middle level functions seems to be closed from users.
Look at MDK5.0 official example: File System Component->Reference->System Routines->fmount:
void main (void) { FILE *f; // Initialize the M: drive. if (finit ("M:") != fsOK) { // error handling ... } // Mount the M: drive. if (fmount ("M:") != fsOK) { // error handling ... } // Update a log file on SD card. f = fopen ("M:\\Logs\\Test_file.log","a"); if (f == NULL) { // error handling ... } else { // write data to file fclose (f); } // The drive is no more needed. funmount ("M:"); funinit ("M:"); .. }
This example make me think that all I need - just to config NAND memory bus and NAND flash device. MDK 5.* already has the NAND flash driver, and commands like a read_flash_ID are already implemented. I think, fmount() consists of step2-step4 from your post, but unfortunatelu I'm not sure and still trying to check that...
This example make me think that all I need - just to config NAND memory bus and NAND flash device. In no intention to sound complaining, but noobs find it difficult. Initially, (as a noob) i had also found the keil documentation troublesome to deal with. They don't have documentation explaining step-by-step process. also, all the related documentation is not placed at any single link, nor do they have a single pdf document. you have to go through all the documentation or use web search engines smartly to get things done. Luckily, we have some really smartians on the forum.
So, I'm interesting just one thing now: this example is just example and nothing more? It doesn't work and I shouldn't even try to run it as is? In this case I'll write driver myself, and it will be much better than work I'm doing now: trying to fix a thing that never worked. Am I right? If yes, I'm starting to write low-level commands to deal with NAND.
Keil's NAND driver works and is waiting for flash's answer. Driver sends Reset, after that it sends GetStatus periodically, but doesn't get any answer. It seems, I have some problems in my NAND-bus configuration.
Hi all I need help, guys.
Yesterday I've got message from Keil's suport team:
"in MDK 5 there is still no support for the K70 nand controller. This is no MemBus type driver. The whole Runtime Environment is not prepared for this.
fsMediaError means there were problems during the initial access of the device, like it does not set the status bits correct. You probably should see one of the driver functions returning an error.
But as said, at the moment MDK 5 does not support this and you would need to look at the legacy support / MDK-ARM 4 support for K70 NAND drivers."
Did somebody use the legacy files? What about their usability? Or the best way is to use mdk 473?