I am trying to run the nandflash and mfs_nandflash examples on a TWR-K60F120M Rev C board. I able to compile and run the examples, but they don't work as expected (details below). I'm using Codewarrior 10.4, MQX 4.0.2 and the MQX 4.0.2 Flash File System patch.
When I run nandflash, I get the "all bad blocks" problem described here: https://community.freescale.com/message/329282. The output I get is:
MQX NAND Flash Example Application
==================================
NAND Flash device nandflash: opened
Obtaining NAND Flash organization data ...
ID: 0x0
Physical page size: 2048 bytes
Spare area size: 64 bytes
Block size: 131072 bytes
Number of blocks: 2048
Width: 16
Number of virtual pages: 524288
Virtual page size: 512 bytes
Block #0 is bad
Block #1 is bad
Block #2 is bad
Block #3 is bad
...
Block #2046 is bad
Block #2047 is bad
Size of the write buffer allocated in RAM: 16384 bytes
Erasing block #0 failed.
Writing data to 16 virtual pages of block #0 ... Done
Reading data back from 16 virtual pages of block #0 ... Failed
Comparing data ... Compare failed
When I run mfs_nandflash, I get a similar problem to that described here: https://community.freescale.com/message/335118#335118. Everything seems to work until I try fsopen, which asks me to run repair. Repair claims to work, and then the next fsopen claims to work, but then "format a:" fails. I have tried multiple permutations, but that is as far as I get:
This is the Flash File System example, type help for list of available commands
If this is the first time you use the demo, you should run "nanderasechip" command first.
Shell (build: Oct 14 2013) Copyright (c) 2013 Freescale Semiconductor;
shell>
shell> nanderasechip
Erasing entire chip ...
Please use fsopen command to re-open NAND flash device.
shell> fsopen
Unable to open nandflash device.
You must run Repair command
shell> nandrepair
Repairing... Repair successfully
shell> fsopen
NAND flash device was opened.
shell> format a:
Error, file system a: not found
I tried to implement the solution described here: https://community.freescale.com/message/335118#335118, but the code snippet described doesn't exist in int_gpio.c. I found a similar snippet in bsp_cm.c and inserted line 4 from the above solution, but it didn't change the results.
Any ideas?
Thanks for the help.
Mike
Mike,
can you try CW 10.4/CW 10.5 GCC compiler ? Recently I used TWR-K60F120M with CW 10.5 GCC compiler and this worked out of the box correctly.
By the way there is memory leak you better fix as shown here:
Martin,
Thanks for the reply. I have been using CW 10.4, but I will try CW 10.5 and let you know how it goes.
Mike