Questions tagged [fatfs]

FatFs is a generic FAT file system module for small embedded systems.

The FatFs module is written in compliance with ANSI C (C89) and completely separated from the disk I/O layer. Therefore it is independent of the platform. It can be incorporated into small microcontrollers with limited resource, such as 8051, PIC, AVR, ARM, Z80, 78K and etc.

Features

  • Windows compatible FAT file system.
  • Platform independent. Easy to port.
  • Very small footprint for code and work area.
  • Various configuration options:

    • Multiple volumes (physical drives and partitions).
    • Multiple ANSI/OEM code pages including DBCS.
    • Long file name support in ANSI/OEM or Unicode.
    • RTOS support for multi-task operation.
    • Multiple sector size support upto 4KB.
    • Read-only, minimized API, I/O buffer and etc...

Application Interface layer

  1. File Access

    • f_open - Open/Create a file
    • f_close - Close an open file
    • f_read - Read data
    • f_write - Write data
    • f_lseek - Move read/write pointer, Expand size
    • f_truncate - Truncate size
    • f_sync - Flush cached data
    • f_forward - Forward data to the stream
    • f_gets - Read a string
    • f_putc - Write a character
    • f_puts - Write a string
    • f_printf - Write a formatted string
    • f_tell - Get current read/write pointer
    • f_eof - Test for end-of-file
    • f_size - Get size
    • f_error - Test for an error
  2. Directory Access

    • f_opendir - Open a directory
    • f_closedir - Close an open directory
    • f_readdir - Read an item
    • f_findfirst - Open a directory and read first item found
    • f_findnext - Read a next item found
  3. File/Directory Management

    • f_stat - Check existance of a file or sub-directory
    • f_unlink - Remove a file or sub-directory
    • f_rename - Rename or move a file or sub-directory
    • f_chmod - Change attribute of a file or sub-directory
    • f_utime - Change timestamp of a file or sub-directory
    • f_mkdir - Create a sub-directory
    • f_chdir - Change current directory
    • f_chdrive - Change current drive
    • f_getcwd - Retrieve the current directory and drive
  4. Volume Management

    • f_mount - Register/Unregister a work area of a volume
    • f_mkfs - Create an FAT volume on the logical drive
    • f_fdisk - Create logical drives on the physical drive
    • f_getfree - Get total size and free size on the volume
    • f_getlabel - Get volume label
    • f_setlabel - Set volume label
  5. Device Control Interface layer

    Since the FatFs module is a file system layer, it is completely separated from the physical devices, such as memory card, harddisk and any type of storage devices. FatFs accesses the storage devices via a simple interface shown below. The low level device control module is not a part of FatFs module. It is provided by implementer. Also sample implementations for some platforms are available in the downloads.

    • disk_status - Get device status
    • disk_initialize - Initialize device
    • disk_read - Read sector(s)
    • disk_write - Write sector(s)
    • disk_ioctl - Control device dependent features
    • get_fattime - Get current time.
118 questions
0
votes
1 answer

STM32F429, FatFs, f_write. Creating a lot of files in a loop with f_write, after several entries FR_DISK_ERR

I'm trying to save lot of files at SD card in the loop with f_write function form FatFs libery, unfortunately after max 50 loop entries f_write returns FR_DISK_ERR. Making one test took over 30 minutes, so I made Enity Test, which saves 10,000 files…
Horns
  • 21
  • 3
0
votes
1 answer

Passing the workspace created with f_mount to another source file

I'm trying to read a file on an SD card using FATFS in an RTOS. The card successfully mounts in a separate source file in the RTOS, but when I try to use the FatFs operations in my own source file, I get the result FR_NOT_ENABLED. This is a somewhat…
Zurn
  • 33
  • 5
0
votes
1 answer

MSP430 SD card application running on top of FATFS appears too restrictive . Is my understanding correct?

I am working my way through an SD card application code example provided by TI for their MSP530 LaunchPad microcontroller development kit. It appears that the example restricts the number of directories and number of files to 10 each (a total of 100…
jaz_n
  • 41
  • 6
0
votes
1 answer

STM32 + FatFS + SDIO + CubeMX

I trying to connect SD-card in 1bit mode to Stm32l4 via FatFS+SDIO interface. Code automaticaly generated by CubeMX 5.0. DMA enabled and configured in Cube. When i call FatFS func like f_mount() or f_open(), i get FR_DISK_ERR return statement. Low…
AndreyLinkin
  • 1
  • 1
  • 2
0
votes
0 answers

FATFS returns FR_DISK_ERR the second time I use an identical line of code

I am using FATFS to write data to an SD card. It partially works and I am able to write EEPROM data to the SD card. But when I use a different function later on in the code it returns 'FR_DISK_ERR' even though I'm using the same line of code. The…
0
votes
1 answer

Copy file using FATFS in Same logical drive

MCU - stm32f407vgt6IDE - True StudioAdditional - CubeMx Description - I am trying to copy a file from USB drive to the same USB drive with diffrent name. Source File - FILE2.txt - This file is present in the drive and Size is 3KB Destination File -…
Ehsan Habib
  • 135
  • 1
  • 5
  • 12
0
votes
2 answers

STMF4 and USB OTG using FATfs

I am using STM32F407 Discovery Board for interfacing USB OTG FS. I am using CubeMx and Keil for development. First thing first, I have enabled PC0 - USB_Power(for Discovery Board) and the state is RESET for proper USB running.I have enabled PA9 -…
Ehsan Habib
  • 135
  • 1
  • 5
  • 12
0
votes
0 answers

STM32F407VET FatFs f_close returns FR_DISK_ERR

I am interfacing SD card(16Gb Sandisk ultra micro SD) to STM32F407 micro-controller with SDIO protocol using chan FatFS library. When I try to write data into existing file, f_write returns FR_OK and returns numbers of written bytes(this value is…
0
votes
1 answer

FR_Not_Enabled Fat_fs error when read sd card?

i am using stmf429 mcu,Ive designed the board by myself, want to read sd card and open it but the f_mount has an error(FR_Not_Enabled).the in initialize is ok.
M.kh
  • 1
  • 1
  • 2
0
votes
1 answer

unable to use f_read() and f_lseek() in Fatfs

I'm trying to connect to a 2GB sd card class 6 with stm32f091cctx MCU via SPI. Using fatFs library ver. R0.13a I'm able to mount the drive and open the file with f_mount and f_open functions. But when it comes to reading from file, it just freezes…
s.sh
  • 1
  • 2
0
votes
1 answer

fatfs : By using f_mkdir() function creating Unknown type file inside the folder

I want to know that after using f_mkdir() function I am creating "SENT" folder but in that folder, one more "SENT" file/folder is created which does not have any description. iFResult = f_stat("/SENT" ,&File_Info); // Check "SENT" folder is //…
DEV
  • 19
  • 3
0
votes
1 answer

FATFS integration on SPI NAND FLASH

I'm trying to integrate FATFS file system on Micron NAND SPI FLASH. I'm using the SPI peripheral of the STM32L486RG as interface. I have developped a low level driver through which I'm able to read, write and erase data from different locations in…
Y.G
  • 51
  • 2
  • 8
0
votes
2 answers

FatFs on AVR, are there strategies to maximize write speed?

Good evening, I am using an Atmega32 (2kB RAM) at 14.7456MHz to log data to a SD card via SPI that runs at ~1.5MHz. FatFs is set to FF_FS_TINY 0 (0 or 1 doesn't seem to influence the write speed as far as I could observe) The data I want to log…
Winter
  • 23
  • 4
0
votes
1 answer

FATFS: How to get address of first sector of a file?

I am using fatfs on stm32 and I want to find the address of first sector of a file which is opened using f_open function. Thus I can use that sector address to access the file as a address offset using low level DMA methods available. How can I get…
Nixmd
  • 775
  • 5
  • 11
  • 20
0
votes
0 answers

Integrate FatFs file system with SPI NAND flash driver for Toshiba memory

I'm working on a project using STM32L486RG microcontroller . I have to interface a Toshiba NAND flash memory using SPI peripheral and integrate the FatFs file system. Now , through my low level driver I'm able to read and write buffers in the NAND…
Y.G
  • 51
  • 2
  • 8