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 */