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.
95 questions
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
  • 2
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
  • 41
  • 1
  • 7
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
  • 655
  • 4
  • 10
  • 17
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
  • 41
  • 1
  • 7
0
votes
1 answer

Cannot mount SD using FatFS on STM32

I'm trying to write to a MicroSD-Card using STM32F405 chip. The pins are connected correctly and each pin on the MicroSD-Card slot can be written to by using HAL_GPIO_WritePin. (Messured with ossciloscope) I'm using CubeMX to generate the init code…
Poehli
  • 187
  • 3
  • 14
0
votes
1 answer

FatFs - FIL Struct causes corrupted memory - STM32F7

STM32F7, GCC, FatFS The following code corrupts the retVal. (For example, the vector is created with only one object, but when you inspect it has an absurd amount) std::vector SDManager::Test() { std::vector retVal(1); FIL…
Matt H
  • 138
  • 1
  • 9
0
votes
0 answers

Error on spi initialize using FatFs module

So i want to implement the FatFs module for my PIC18F46J50 microctontroller and i get an error building my project which i cant get ahead of. I did my necessary changes on the low level disk Io modules but i still cant seem to get it working. So…
keko
  • 37
  • 8
0
votes
1 answer

passing local pointer to function FatFs

I have the following function in C: char* AUDIO_GetFile(FIL* fil, DIR* dir, FILINFO* fno) { FRESULT res; res = f_readdir(dir, fno); /* Read a directory item */ if (fno->fname[0] == '\0')} /* End of files */ ... } ... …
KRol
  • 56
  • 1
  • 7
0
votes
1 answer

Appending data with FatFS in a uSD

I am using a SAMG55 and the FatFS library included in the ASF, everything seems to work properly, but when I try to append data to a file periodically it only works the first time. I mean, if my file has a size of 100, the first time the…
JMP
  • 1
  • 1
0
votes
1 answer

No high on CS while writing to SD-Card with FatFs

I am hard struggling to set up my PIC project, with a SD card, that uses FatFs. I simulate it in Proteus - but during the full writing process, there is no high on the CS line from the SD card. The other works. I already checked the pin…
0
votes
2 answers

Casting an uint8_t* to uint32_t* in c++

I am trying to implement an interface function of the FATFS library. The implementation expects an uint8_t* to the data that has to be written to an internal SD card by a different library. The data should be written to the library using the…
Alex van Rijs
  • 793
  • 4
  • 15
  • 36
0
votes
0 answers

FatFs - f_open Hard Fault

I am trying to write some data on SD card connected with SPI (I am using a STM32F303). I can mount the SD card but when I want to create a file and open it I get a Hard Fault issue at line 3398 in function f_open of the file ff.c: 3395: fp->obj.fs…
Jordan
  • 1
  • 3
0
votes
0 answers

FatsFs, eeprom energy consumption

I am working on TI MCU(cc1310), I want to save data in the internal flash, I have few questions about using the flash directory, or external eeprom. Using the flash can causes greater power consumption the using external eeprom memory? Using FatFs…
0
votes
1 answer

STM32 : FatFs Library - f_mount

I am programming the STM32F0 (Keil uVision 5). I've tried to use FatFs library to manage a file system (SD card). I've writen every initialization functions and the project is compiling without any errors / warnings. But first function f_mount…
HynHiX
  • 1
  • 1
  • 3