Hi David,
After many days testing my software, I saw there is an assert error only when entering in debug mode, but it doesn't happen if I download the code without debugging. So I decided to continue my development without keep in mind this problem, because it was causing me a big delay...
Now I can open and close a file in the Nand Flash and what I want is to copy a file from SD to Nand Flash file system. I have checked that the file is succesfully copied (I can read all the bytes using the shell example), but I can't read it on my program! A critical problem is happening when FFS library tries to wirte a sector (ddi_ldl_write.cpp):
RtStatus_t DriveWriteSector
(
/* [IN] Unique tag for the drive to operate on. */
DriveTag_t tag,
/* [IN] Sector to write; 0-based at the start of the drive. */
uint32_t u32SectorNumber,
/* [IN] Pointer to buffer of sector data to write. */
const SECTOR_BUFFER * pSectorData
)
{ /* Body */
/* Get drive depending on its tag */
LogicalDrive * drive = DriveGetDriveFromTag(tag);
if (!drive)
{
return ERROR_DDI_LDL_LDRIVE_INVALID_DRIVE_NUMBER;
}
else if (!drive->isInitialized())
{
return ERROR_DDI_LDL_LDRIVE_NOT_INITIALIZED;
} /* Endif */
#if defined(USE_NAND_STACK) && defined(NO_SDRAM)
if (drive->getMedia()->getPhysicalType() != kMediaTypeMMC)
{
static RtStatus_t s_RetValue;
TX_THREAD *pCurrentThread;
tx_mutex_get(&g_NANDThreadSafeMutex, TX_WAIT_FOREVER);
pCurrentThread = tx_thread_identify();
if (pCurrentThread != NULL)
{
os_thi_SaveStackContext(&g_NewNandStackContext, pCurrentThread, &g_OldNandStackContext, 40);
}
s_RetValue = drive->writeSector(u32SectorNumber, pSectorData);
if (pCurrentThread != NULL)
{
os_thi_RestoreStackContext(&g_OldNandStackContext, pCurrentThread);
}
tx_mutex_put(&g_NANDThreadSafeMutex);
return s_RetValue;
} /* Endif */
#endif /* Defined(USE_NAND_STACK) && defined(NO_SDRAM) */
return drive->writeSector(u32SectorNumber, pSectorData); // HERE THE PROGRAM BREAKS!
} /* Endbody */
Any suggestions about in which cases can occur this? I am checking all my program to find what I am making wrong: I checked the seek mode, options passed when opening the file, ...