FFS on NANDFLASH of TWR-K70 (MQX 4.0.1)

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

FFS on NANDFLASH of TWR-K70 (MQX 4.0.1)

Jump to solution
3,406 Views
friederschrempf
Contributor IV

I want to install the Flash File System (FFS) from NAND Flash File System patch for Freescale MQX™ RTOS 4.0.0 on the NANDFLASH chip on the TWR-K70.

I'm running the included example and I'm getting the following terminal output:

Shell (build: Mar 21 2013)

Copyright (c) 2008 Freescale Semiconductor;

shell>

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> dir

Error, file system not mounted

shell>

Has someone got an idea what might be wrong. Are there any jumper settings necessary?

Is it correct that ENABLE_NANDFLASH must be set to zero in the BSP like stated in the nandflash_wl_config.h?

Thank you for your help!

Labels (1)
0 Kudos
1 Solution
1,350 Views
Martin_
NXP Employee
NXP Employee

You need to add two lines (3 and 4 in the code snippet below) into _bsp_nandflash_io_init() in the BSP init_gpio.c, in order to specify divider of NFC clock:

SIM_SOPT2_REG(SIM_BASE_PTR) |= SIM_SOPT2_NFCSRC(0x00);

/* SIM_CLKDIV4: NFCDIV=7 */

SIM_CLKDIV4 &=  0x00FFFFFF; /* clear 8 most significant bits */

SIM_CLKDIV4 |=  SIM_CLKDIV4_NFCDIV(7);

/* Enable clock gate to NFC module */

sim->SCGC3 |= SIM_SCGC3_NFC_MASK;

I tried that this works with PE Generated Code for the TWR-K70F120M BSP.

View solution in original post

0 Kudos
12 Replies
1,350 Views
okaner
Contributor III

Hi,

     I am using TWR-K60. and I am able to run example project. but when I restart and call fsopen, it says "NOT A DOS DISK! You must format to continue.". how can I solve this problem.

     Also after formatting, it says "Free disk space: 10723328 bytes", although I have 2Gb nand flash.

Thank you...

0 Kudos
1,350 Views
danielchai
Senior Contributor I

Hi Okan,

Which version of MQX are you using? Check here Change size of FFS drive (MQX 4.0.1, TWR-K70)

-Daniel

0 Kudos
1,350 Views
Martin_
NXP Employee
NXP Employee

Try "nanderasechip" command, as recommended by the MQXFFSUG Rev 1.1 on page 34.

0 Kudos
1,350 Views
friederschrempf
Contributor IV

Thank you for your answer.

I tried with "nanderasechip", but still the same problem:

Shell (build: Mar 21 2013)

Copyright (c) 2008 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> dir

Error, file system not mounted

shell>

Can you tell me where I can find the MQXFFSUG document you are talking about? It is not in my FFS directory and I can find it nowhere else either.

Thanks!

0 Kudos
1,350 Views
Martin_
NXP Employee
NXP Employee

in the /doc/ffs.

Have you tried nandlfash demo (without wear leveling layer) just to check the NFC driver works in your BSP setup ? /mqx/examples/nandflash/

For this demo you will need BSPCFG_ENABLE_NANDFLASH.

1,350 Views
friederschrempf
Contributor IV

Sorry. I forgot to look in the most obvious place for the user guide.

I tried the basic nandflash example and got the following output (shortened):

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 #2047 is bad

Failed to get write buffer


Does this tell you something?

0 Kudos
1,350 Views
friederschrempf
Contributor IV

I added "block_size = block_size/8;" to nandflash_demo.c (line 250) as it is added for K60. Now I get:

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 #2047 is bad

Erasing block #0 failed.

Writing data to 32 virtual pages of block #0 ... Done

Reading data back from 32 virtual pages of block #0 ... Failed

Comparing data ... Compare failed


0 Kudos
1,350 Views
Martin_
NXP Employee
NXP Employee

Still using Flexbus for TWR-LCD ? Some Flexbus signals are shared with NFC signals. Like PTB20 being NFC_DATA1 or FB_AD31. Try to remove the TWR-LCD from the tower.

0 Kudos
1,350 Views
friederschrempf
Contributor IV

I had the same idea and I already isolated the tower board from the rest of the hardware to avoid any interferences.

Actually I found the cause of the problem here in this unanswered question: nand_flash mqx demo doesn't work on K70

I removed "Sources" and the "Generated Code" directory from my BSP, recompiled it and now the NANDFLASH example works like a charm. I haven't tested FFS yet, but I guess that the problems there were caused by the same "bug".

Maybe someone should have a closer look why PE code interferes with NANDFLASH.

0 Kudos
1,351 Views
Martin_
NXP Employee
NXP Employee

You need to add two lines (3 and 4 in the code snippet below) into _bsp_nandflash_io_init() in the BSP init_gpio.c, in order to specify divider of NFC clock:

SIM_SOPT2_REG(SIM_BASE_PTR) |= SIM_SOPT2_NFCSRC(0x00);

/* SIM_CLKDIV4: NFCDIV=7 */

SIM_CLKDIV4 &=  0x00FFFFFF; /* clear 8 most significant bits */

SIM_CLKDIV4 |=  SIM_CLKDIV4_NFCDIV(7);

/* Enable clock gate to NFC module */

sim->SCGC3 |= SIM_SCGC3_NFC_MASK;

I tried that this works with PE Generated Code for the TWR-K70F120M BSP.

0 Kudos
1,350 Views
RuiFaria
Contributor III

hi,

Is it a bug fix? Why did not it come out with the release 4.1.0 of MQX?

Thranks,

Rui Faria

0 Kudos
1,350 Views
lorenzofornari
Contributor III

freescale please fix this

0 Kudos