Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner