This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to open and access files in directory other than root directory in fatfs ?

Hi ,

I am working interfacing SD card with nrf52 using fatfs example given in SDK 12.0.0. While writing to text file created in root directory, code gets stopped as size of file becomes greater than 300kB. Is it because of the size limitation of writing in root directory?

To prevent this , I am trying to create new directory and write into text files in it. I have created new folders (directories) in SD card. Now I have to create files in it. But I don't how to go inside the created folder or directory. are there any rules for specifying path names in fatfs ?

Do I need to mount separate volume for this?

SD_card_RTC.c

Parents
  • Hi.

    I haven't noticed the size limitation in my setup. What is the SPI clock speed? There might be some communication artifacts due to GPIO output strength with some cards. If you're running at 8MHz then try do lower the frequency to 4 or 2MHz and check if the problem still exists.

    To open/create the file in a specific directory, add this directory to the path, e.g. "logs/1.txt". You may also use full path including drive number - "0:/path/file.txt" (see the fatfs documentation for logical volume configuration if using multiple volumes). Paths without the drive number are relative to current directory (set by fs_chdir) only when _FS_RPATH is enabled (disabled by default). See the description here: elm-chan.org/.../filename.html .

Reply
  • Hi.

    I haven't noticed the size limitation in my setup. What is the SPI clock speed? There might be some communication artifacts due to GPIO output strength with some cards. If you're running at 8MHz then try do lower the frequency to 4 or 2MHz and check if the problem still exists.

    To open/create the file in a specific directory, add this directory to the path, e.g. "logs/1.txt". You may also use full path including drive number - "0:/path/file.txt" (see the fatfs documentation for logical volume configuration if using multiple volumes). Paths without the drive number are relative to current directory (set by fs_chdir) only when _FS_RPATH is enabled (disabled by default). See the description here: elm-chan.org/.../filename.html .

Children
No Data
Related