This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Embedded filesystem problem question

Hello

I deployed the Embedded Filesystem using the QSPI NOR FLASH(N25Q032A 4Mbyte).

My system environment is as follows.

OS : Windows 7
MDK version : uVision V5.23.0.0 (MDK-PLUS EDITION)
CMSIS version : v5.0.1
Compiler version : v1.3.1
Middleware version : v7.4.1
MCU : STM32F745
NOR Flash : N25Q032A(QSPI) (4MByte)

I made the EFS driver using the AT454 DBD2D file provided as a sample file.

/* Flash Driver Control Block */
ARM_DRIVER_FLASH ARM_Driver_Flash_(0) = { GetVersion, GetCapabilities, Initialize, Uninitialize, PowerControl, ReadData, ProgramData, EraseSector, EraseChip, GetStatus, GetInfo
};

I added the QSPI driver for N25Q032A and added it to the EFS function.

int32_t ReadData (uint32_t addr, void *data, uint32_t cnt)
{ …………
BSP_QSPI_Read(data, addr, cnt) ;
…………
}

int32_t ProgramData (uint32_t addr, void *data, uint32_t cnt)
{ …………
BSP_QSPI_Write (data, addr, cnt) ;

printf("ProgramData() addr = 0x%x, cnt = %d...\r\n",addr, cnt) ;
…………
}

After format, I tested it.

FILE *fout;
char buf[4096];

memset(buf, 0x37, 4096) ;

finit ("F0:") ;
fmount ("F0:") ;
fformat ("F:","") ;

fout = fopen (“testfile.txt”, "a");

while(1)
{ fwrite (buf, 4096, 1, fout);
sleep(1000) ; // 1sec sleep
}

After 10 minutes, the writing stops.
Debug messages are shown below.

ProgramData() addr = 0x2550c, cnt = 12...
ProgramData() addr = 0x2ffac, cnt = 8...
ProgramData() addr = 0x25518, cnt = 4096...
ProgramData() addr = 0x2ffa4, cnt = 8...
ProgramData() addr = 0x26518, cnt = 4096...
ProgramData() addr = 0x2ff9c, cnt = 8...
ProgramData() addr = 0x27518, cnt = 4096...
ProgramData() addr = 0x2ff94, cnt = 8...
ProgramData() addr = 0x28518, cnt = 4096...
ProgramData() addr = 0x2ff8c, cnt = 8...
ProgramData() addr = 0x29518, cnt = 4096...
ProgramData() addr = 0x2ff84, cnt = 8...
ProgramData() addr = 0x2a518, cnt = 1280...
ProgramData() addr = 0x2ff7c, cnt = 8...
ProgramData() addr = 0x2fff8, cnt = 4...
ProgramData() addr = 0x2fff0, cnt = 4...
ProgramData() addr = 0x2ffe8, cnt = 4...
ProgramData() addr = 0x2ffe0, cnt = 4...
ProgramData() addr = 0x2ffd8, cnt = 4...
ProgramData() addr = 0x2ffd0, cnt = 4...
ProgramData() addr = 0x2ffc8, cnt = 4...
ProgramData() addr = 0x2ffc0, cnt = 4...
ProgramData() addr = 0x2ffb8, cnt = 4...
ProgramData() addr = 0x2aa18, cnt = 12...
ProgramData() addr = 0x2ff74, cnt = 8...
ProgramData() addr = 0x2aa24, cnt = 4096...
ProgramData() addr = 0x2ff6c, cnt = 8...
ProgramData() addr = 0x2ba24, cnt = 4096...
ProgramData() addr = 0x2ff64, cnt = 8...
ProgramData() addr = 0x2ca24, cnt = 4096...
ProgramData() addr = 0x2ff5c, cnt = 8...
ProgramData() addr = 0x2da24, cnt = 4096...
ProgramData() addr = 0x2ff54, cnt = 8...
ProgramData() addr = 0x2ea24, cnt = 4096...
ProgramData() addr = 0x2ff4c, cnt = 8...
ProgramData() addr = 0x2fa24, cnt = 1280...
ProgramData() addr = 0x2ff44, cnt = 8...
ProgramData() addr = 0x2ffb4, cnt = 4...
ProgramData() addr = 0x2ffa8, cnt = 4...
ProgramData() addr = 0x2ffa4, cnt = 4...
ProgramData() addr = 0x2ff98, cnt = 4...
ProgramData() addr = 0x2ff94, cnt = 4...
ProgramData() addr = 0x2ff88, cnt = 4...
ProgramData() addr = 0x2ff84, cnt = 4...

The architecture of the EFS is as follows:
- Increasing the Allocation records pointer.
- Decreasing the File fragments pointer.
- Decreasing the Free space

If the pointer overlaps, I wonder if the file system is broken.

Every time I create a file, I am tired because the files are broken.

Please advise.