Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Freertos+FAT, data is lost.

Posted by nstcl on July 6, 2017

Hi: Hardware: STM32F207+S25FL128P Software:Freertos+FAT, Spansion FFS FTL Driver. Step 1: I write 20 bytes data into file /log/dat.bin, the print info as; [FileSystemFileWriteCmd:587]:Write File:/log/dat.bin data(len=20) OK! [slldWriteOp:4791]:sysaddr=0xde0020, leninbytes=32 [slldWriteOp:4791]:sysaddr=0xd73e00, leninbytes=512 [slldWriteOp:4791]:sysaddr=0xde0040, leninbytes=32 Write file(/log/dat.bin, testdata0inlogfile.) ok! I dump the file /log/dat.bin ,the print info as: DPET:dump /log/dat.bin DPET:[FileSystemFileDumpCmd:472]:File /log/dat.bin len=20!

0000: 74 65 73 74 64 61 74 61 30 69 6E 6C 6F 67 66 69 0100: 6C 65 2E 00

Step 2: I read data from flash directly, the print info as below: DPET:flashr 0xd73e00 1 20 DPET:FLASH READ(addr=0xd73e00, unit=1, length=0x14) OK!

74 65 73 74 64 61 74 61 30 69 6e 6c 6f 67 66 69 6c 65 2e 00

Step 3: reset the CPU

Step 4: I dump the file /log/dat.bin ,the print info as: DPET:dump /log/dat.bin DPET:[FileSystemFileDumpCmd:466]:File /log/dat.bin len=0! I get the file length through ff_filelength() function. I can not find the data in my file!

Step 5: I read the data from flash, the info as below: DPET:flashr 0xd73e00 1 20
DPET:FLASH READ(addr=0xd73e00, unit=1, length=0x14) OK!

74 65 73 74 64 61 74 61 30 69 6e 6c 6f 67 66 69
6c 65 2e 00.

My question is the data was writen to the flash sucessfully, but the FAT system can not read it. Why? I do not find a function like fflush() in linux. Please help me. Thank you.


Freertos+FAT, data is lost.

Posted by heinbali01 on July 6, 2017

Hi Lifei Yan,

Would it be possible that data has not been flushed to the flash at the moment the CPU gets a reset? What I do know is that FreeRTOS+FAT will always flush data to disk as soon as you call ff_fclose(). But I do not know about your driver for the Spansion? Can you point out where to find that driver?

Regards.


Freertos+FAT, data is lost.

Posted by nstcl on July 7, 2017

Hi Hein Tibosch, The data has been flushed to the flash at the moment the CPU gets a reset. In Step 5 : After reset, I read the data from flash, the info as below: DPET:flashr 0xd73e00 1 20 DPET:FLASH READ(addr=0xd73e00, unit=1, length=0x14) OK! 74 65 73 74 64 61 74 61 30 69 6e 6c 6f 67 66 69 6c 65 2e 00. wo can see that after reset, the data is in flash,but FAT can not get it.

We can apply Spansion driver through the link: http://www.cypress.com/forum/nor-flash/where-get-spansion-flash-file-system-and-block-driver

Regards.


Freertos+FAT, data is lost.

Posted by heinbali01 on July 7, 2017

Lifei Yan, I looked at the Cypress forum but didn't find a link to the driver. It looks like one has to apply for it. And I'm not going to do that.

I do not find a function like fflush() in linux.

Yes there is this function:

~~~ FFErrort FFFlushCache( FFIOManager_t *pxIOManager ) ~~~

Now if you want me to check the source code, you can send it privately to h [dot] tibosch [at] freertos [dot].org


Freertos+FAT, data is lost.

Posted by nstcl on July 10, 2017

Hi Hein Tibosch, Thank you very much. I made a mistake in my code. There are to methods to solve this problem . 1, In Spansion FTL configuration file ftlifex.h, the FTLRPBCACHE should be set to FALSE. 2, The function FTLFlushTableCache() and FTLFlushDataCache() should be called when FFFlushCache( FFIOManager_t pxIOManager ) is called.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists