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

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
  • 137
  • 1
  • 10
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
  • 10
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 */ ... } ... …
KaDw
  • 78
  • 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
  • 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…
Lukas Fürst
  • 81
  • 11
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
  • 803
  • 5
  • 17
  • 39
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
  • 4
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
0 answers

Fatfs SPI Flash File System

I develop file system on spi flash memory with Chan's FATFS library.I create file on spi flash but not write anything.When i write some text on file i get disk full error.For fatfs library free space equal 0x0000 but on spi flash free space equal…
Emp_Otto
  • 1
  • 1
-1
votes
1 answer

How do I ensure that the read index of the directory object is rewound in FATFS?

I'm guessing this is a basic question: I'm using the f_readdir function in FatFs to read the contents of a directory from a command line, but I'm having trouble getting the function to run multiple times. It works fine the first go around: I type…
Zurn
  • 33
  • 5
-1
votes
1 answer

example for low layer fatfs for spi flash

I want to launch the FatFs file system library for SPI FLASH memory. I need an example or a guide to port the low layer of the this library. FatFs Link: http://elm-chan.org/fsw/ff/00index_e.html SPI FLASH Part number: W25Q64FV MCU Type: STM32F107VC
-1
votes
1 answer

stm32f4 fatfs f_write whitemarks

Im struggling with fatfs on stm32f4. With no problem i can mount, create file and write on it by : char my_data[]="hello world" and in windows file shows normally but when i try use code as loger : float bmp180Pressure=1000.1; char…
PawelW
  • 21
  • 1
  • 6
-2
votes
1 answer

Write to file in binary on a microcontroller

I'm using a STM32476 Nucleo board, and right now I write some data from sensors in a readable file, but it's way too slow. To show some code of what I'm doing now: static char buffer[LINE_MAX]; char* p = buffer; p += sprintf(p, "%f,%f,%f,",…
John Dign
  • 147
  • 1
  • 8
1 2 3 4 5 6 7
8