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

Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Prithwee on January 23, 2009
Dear All,

I have ported the FreeRTOS on our proprietary DSP core.
Also ported an open source FAT File system and its working fine with my SD card driver.
http://elm-chan.org/fsw/ff/00index_e.html

But FATFS do not support multitasking environment.

FATFS Application note says that

“Porting to RTOS-When use FatFs module from only one task, no consideration is needed.
However when make access to a logical drive from two or more tasks simultaneously, any exclusion control will be required.”

Even after doing the semaphore control using mutex, I could not access multiple files from different tasks.

Example: File-A is opened in Task-A and doing some operation on it (f_lseek),
simultaneously I can not access to the file pointer of File-B in Task-B.


Do you have any suggestions on this?

Have anyone of you ported FATFS or any other File system for FreeRTOS and working in multitasking environment?


My target:
A: Audio files playing with audio decoder in Task-A.
B: JPG files displaying with JPG decoder in Task-B.

TIA.

Regards,

Prithwee.

RE: Multi-tasking FAT Filesystem for FreeRTOS

Posted by woops_ on January 23, 2009
go to http://www.jcwren.com/arm/

RE: Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Prithwee on January 26, 2009
Yes, that was a good referance for my project. Thnak you.

But my actual problem lies in the implementation of FATFS for RTOS.

http://elm-chan.org/fsw/ff/en/appnote.html

-->Problems and Ideas-->Porting to RTOS.

Because of this shared resource filesystem, after mutex locking am not able to access the 2nd file on a 2nd Task while 1st file on 1st task is already open. It will give the access to the 2nd file only after 1st file will be operated with "f_close".

Any solution to do operation on both the files simaltanously on differnt tasks?


TIA.

Regards,

Prithwee.


RE: Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Jack Peacock on January 26, 2009
From your description the 1st task is not releasing the mutex between file accesses, so the 2nd task is always blocked while waiting for the mutex. Either release the mutex between file system calls or implement the file system as a separate task and send filesystem requests to the FS task in a queue, which will serialize access to the resource, replacing the mutex.

RE: Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Marcelo Adrian Lorenzati Sanz on August 17, 2009
Hi, I´ve used the Chan´s FAT implementation for FAT filesystems (FATTF) succesfully with Freertos.
This FAT driver only need the diskio implementation for your device (SD, MMC, NANDFlash etc), so in my case I developed an SD driver with SPI handling.
In my SPI driver I use FreeRTOS, so Chan´s Fat becomes FreeRTOS enabled (thread safe).

You can see the code in this forum (in spanish but the code is english commented).

http://www.sistemasembebidos.com.ar/forum/index.php?topic=730.0

Also I place it in google code:
http://code.google.com/p/sistemasembebidos/

With a AT91SAM7S at 47.9 Mhz I get 370Kbytes/sec for read and write files (maybe because I use old MMCs...)

Regards!

RE: Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Marcelo Adrian Lorenzati Sanz on August 17, 2009
Sorry for the misspell I mean FATFS

RE: Multi-tasking FAT Filesystem for FreeRTOS.

Posted by Prithwee on August 18, 2009
Hi darukur,

Can you access your sd-card READ/WRITE simaltanously from different tasks?

Your example code shows copy operation in a single task-vFatFsDemo.

How about "READ" in Task-A and Write in Task-B?
Did you consider the Re-Entrant functionality and resource locking for FATFS?

Regards,
Prithwee.


[ 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