unable to use correctly the FFS

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

unable to use correctly the FFS

Jump to solution
828 Views
arnogir
Senior Contributor II

shell> nand_erase_ffs

nand_erase_ffs

Erasing FFS area from block #10 to block #2010...

Please use "ffs_open" command to re-open NAND flash device.

shell> ffs_open

ffs_open

Error opening filesystem: UNKNOWN ERROR !!!<CR><LF>

Hello

I'm using a Kinesis K70F150

My board is exactly the same as TWRK70f120m (For DDR and nandflash)


I'm using MQX 4.1.1 rev1.3

And I try the ffs exemple (C:\Freescale\Freescale_MQX_4_1\ffs\examples\mfs_nandflash). But I can't open correctly the nandflash. Please find below the trace:

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 "nand_erase_ffs" command first.

Shell (build: Nov 17 2014)

Copyright (c) 2013 Freescale Semiconductor;

shell>

shell> nand_erase_ffs

nand_erase_ffs

Erasing FFS area from block #10 to block #2010...

Please use "ffs_open" command to re-open NAND flash device.

shell> ffs_open

ffs_open

Unable to open NAND Flash device.

You must run "ffs_repair" command

shell> ffs_open

ffs_open

Error opening filesystem: UNKNOWN ERROR !!!


shell> ffs_open

ffs_open

Unable to open NAND Flash device.

You must run "ffs_repair" command

shell> ffs_repair

ffs_repair

Repairing...

Error opening filesystem: UNKNOWN ERROR !!!

Another after a board restart:

...

shell> ffs_repair

ffs_repair

Repairing...

You must re-open

shell> ffs_repair

ffs_repair

Repairing...

Error opening filesystem: UNKNOWN ERROR !!!

Another were the erase seems work! ???

So, I'm unable to work with nandflash. I try all command, but nothing work.

I also apply a patch given in this forum:

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:

  1. SIM_SOPT2_REG(SIM_BASE_PTR) |= SIM_SOPT2_NFCSRC(0x00); 
  2. /* SIM_CLKDIV4: NFCDIV=7 */ 
  3. SIM_CLKDIV4 &=  0x00FFFFFF; /* clear 8 most significant bits */ 
  4. SIM_CLKDIV4 |=  SIM_CLKDIV4_NFCDIV(7); 
  5. /* Enable clock gate to NFC module */ 
  6. sim->SCGC3 |= SIM_SCGC3_NFC_MASK;

Did you have an Idea?

For information on Open, on step by step:

mfs_init.c : MFS_Open_Device : error_code = MFS_Read_device_sector(drive_ptr, BOOT_SECTOR, drive_ptr->DIR_SECTOR_PTR);

This step, return error 0x0A02

0 Kudos
1 Solution
435 Views
arnogir
Senior Contributor II

Hello

In fact, my borad has a flash MT29F2G08, not an MT29F2G16, then I create a file C:\Freescale\Freescale_MQX_4_1\mqx\source\io\nandflash\nand_devices\MT29F2G08.c and modify the with from 16 to 8

View solution in original post

0 Kudos
3 Replies
435 Views
soledad
NXP Employee
NXP Employee

Hi Arno Gir:

For NAND flash, bad blocks are blocks that contain one or more invalid bits whose reliability is not guaranteed. Bad blocks may be present when the NAND flash device is shipped, or may develop during the lifetime of the device.

First time usage of FFS requires to run "nanderasechip" command. It is used to build the bad block information for the FFS later use.

This is written in the MQXFFSUG manual.

As the bad blocks develop during lifetime of the application, FFS marks them as bad and updates bad block information table.

To run FFS example (the first time), make sure that you erased all necessary blocks which are defined to use with FFS (you can use “nanderasechip” command).

Please try "nanderasechip" command of \ffs\examples\mfs_nandflash\ on the NAND flash, before doing format.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
435 Views
arnogir
Senior Contributor II

Hi

I tried ffs_erase_drive and nand_erase_ffs.

In the example ffs\examples\mfs_nandflash\ and can't find command "nanderasechip"
(you will find the demo.ccp and the pdf in attached file of my example)

Bellow is the trace of my test:

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 "nand_erase_ffs" command first.

Shell (build: Nov 17 2014)

Copyright (c) 2013 Freescale Semiconductor;

shell>

shell> ffs_erase_drive

ffs_erase_drive

Erasing FFS drive ...

Some errors occurred. Please close the device and try again.

shell> ffs_erase_drive

ffs_erase_drive

Erasing FFS drive ...

Some errors occurred. Please close the device and try again.

shell> nand_erase_ffs

nand_erase_ffs

Filesystem must be closed before erase

shell> nand_erase_ffs

nand_erase_ffs

Filesystem must be closed before erase

shell> ffs_close

ffs_close

Error uninstalling filesystem.

nand_erase_ffs

nand_erase_ffs

[Board not response, OS task are terminated. Board is restarted here]


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 "nand_erase_ffs" command first.

Shell (build: Nov 17 2014)

Copyright (c) 2013 Freescale Semiconductor;

Copyright (c) 2013 Freescale Semiconductor;<CR><LF>

shell>

shell> nand_erase_ffs

nand_erase_ffs

Erasing FFS area from block #10 to block #2010...

Please use "ffs_open" command to re-open NAND flash device.


shell> ffs_erase_drive

ffs_erase_drive

Erasing FFS drive ...

Some errors occurred. Please close the device and try again.

shell> nanderasechip

nanderasechip

Invalid command. Type 'help' for a list of commands.

The code executed on the command ffs_erase_drive is following:

void ffs_erase_drive() { if (nandflash_handle == NULL) { nandflash_handle = fopen(FFS_DEVICE, NANDWL_OPEN_FORCE_REPAIR_WHEN_FAILED); } printf("\nErasing FFS drive ... \n"); if (MQX_OK != ioctl(nandflash_handle, NANDFLASH_IOCTL_ERASE, (void*)0)) { printf("\nSome errors occurred. Please close the device and try again.\n"); return; } else

The fopen return always a NULL pointer. Then on the IOCtl(nandflash_handle..., the first test inside is:

if (file_ptr == NULL) {

   return(IO_EOF);

  } /* Endif */

Then error is returned.

Edit: If I execute command a second time, fopen return a valid pointer. I'm trying step by step to see where error is detected...

--------------------------------------------------------------------------

2nd Edit: code executed:

-> ffs_erase_drive()

-> ioctl(nandflash_handle, NANDFLASH_IOCTL_ERASE, (void*)0)

-> result = (*dev_ptr->IO_IOCTL)(file_ptr, cmd, param_ptr)   (= _io_nandflash_wl_ioctl)

-> result = _io_nandflash_wl_internal_erase(fd_ptr)

-> status = DriveErase(DRIVE_TAG_DATA, 0 /* Currently unsused */)

Then in DriveErase (ddi_ldl_write.cpp) following test is done:

else if (!drive->isInitialized() )

 

   return ERROR_DDI_LDL_LDRIVE_NOT_INITIALIZED;

  } /* Endif */

Then this error is returned!

------------------------------------------

3th edit.

Then I'm looking for why m_initialized is false.

This variable is set on fopen.

mapper:init is called and then m_initialized is set to true in mapper::createZoneMap.

But in this function there are following code:

m_isInitialized = true; /* Don't let the NAND go to sleep during the scans. */ NandHal::SleepHelper disableSleep(false);


When I made a  step on NandHal::sleepHelper disableSleep(false), there are a strange behavior, the call stack return to upper layer and goes to another way to finish in mapper::shutdown!

In this m_initisatized is reset to false...


So I don't understand this strange behavior on the line NandHal::SleepHelper disableSleep(false);.....


------------------------------------------

4th edit.


If I don't make step on this instruction, code continue correctly.

But now, I have the following way:

Mapper::Init

Mapper::createZoneMap

PersistentPhyMap::saveNewCopy

Mapper::getBlock

Mapper::allocateBlock

And in it, I return the following error:

if (!foundAvailableBlock)

 

   return ERROR_DDR_NAND_MAPPER_PHYMAP_MAPFULL;

  } /* Endif */


0 Kudos
436 Views
arnogir
Senior Contributor II

Hello

In fact, my borad has a flash MT29F2G08, not an MT29F2G16, then I create a file C:\Freescale\Freescale_MQX_4_1\mqx\source\io\nandflash\nand_devices\MT29F2G08.c and modify the with from 16 to 8

0 Kudos