Hello,
with your assistance, I successfully used a NOR flash as a fatFs media.
First, manage to mount the media . : Following the next steps:
- FF_CreateIOManager(&xParameters, &xFFError);
- FF_Partition(pxDisk, &xPartition);
- FF_Format(pxDisk, 0, pdTRUE, pdTRUE).
- FF_FlashMount(PxDisk)
next:
I attempt to open a file with the following simple code:
/* Generate a file name. */
char cFileName[fsMAX_FILE_NAME_LEN]; sprintf(cFileName, "root%03d.txt", (int) xFileNumber)
/* Open the file, creating it if it doesn't exist. */
pxFile = ff_fopen(cFileName, "w");
The ff_fopen function calls FF_FS_Find(pcFile, &xHandler), which in turn calls the following code:
int FF_FS_Find( const char * pcPath, FF_DirHandler_t * pxHandler )
{
FF_SubSystem_t * pxSubSystem;
size_t uxPathLength;
BaseType_t xUseIndex;
int iReturn;
pxSubSystem = file_systems.xSystems + 1;
uxPathLength = strlen( pcPath );
memset( pxHandler, '\0', sizeof( *pxHandler ) );
for( xUseIndex = 1; xUseIndex < file_systems.xFileSystemCount; xUseIndex++, pxSubSystem++ )
{
/* System "/ram" should not match with "/ram/etc". */
if( ( uxPathLength >= ( size_t ) pxSubSystem->xPathlen ) &&
( memcmp( pxSubSystem->pcPath, pcPath, ( size_t ) pxSubSystem->xPathlen ) == 0 ) &&
( ( pcPath[ pxSubSystem->xPathlen ] == '\0' ) || ( pcPath[ pxSubSystem->xPathlen ] == '/' ) ) )
{
if( pcPath[ pxSubSystem->xPathlen ] == '\0' )
{
pxHandler->pcPath = rootDir;
}
else
{
pxHandler->pcPath = pcPath + pxSubSystem->xPathlen;
}
pxHandler->pxManager = pxSubSystem->pxManager;
break;
}
}
if( xUseIndex == file_systems.xFileSystemCount )
{
pxHandler->pcPath = pcPath;
pxHandler->pxManager = file_systems.xSystems[ 0 ].pxManager;
}
if( FF_Mounted( pxHandler->pxManager ) )
{
iReturn = pdTRUE;
}
else
{
iReturn = pdFALSE;
}
return iReturn;
}
The ‘if’ statement inside the for loop evaluates to FALSE.
then FF_Mounted - failed because pxIOManager==0 (NULL)
Is there a problem with the FatFs configuration?
If you require any additional information, please let me know.
Thnaks
William