2

Fatfs is a small library written in C ansi that lets us manage a file system on a storage device. I am planning on using it in an embedded project in order to store several files on an SD Card.

Therefore I try to make some tests on a USB flash drive, having downloaded the provided examples. I can mount my usb flash drive.

After having compiled the sources without the option FS_READONLY, I have initialized my drive and mounted it as well. But I cannot create a directory!

Here is the commands I entered within the prompt example provided here: http://elm-chan.org/fsw/ff/ffsample.zip

>fi 2  (force initialisation)
rc=0 FR_OK
>di 2  (mount the drive)
rc=0
Sector size = 512
Number of sectors = 30282525
>fj (switch the current drive to '2', which is actually my usb stick)
rc=0 FR_OK
>fk foo (Attempt to create a dir called 'foo')
rc=1 FR_DISK_ERR

Taking a look at the documentation, we're informed that FR_DISK_ERR refers to an hardware error.

Is my flash drive badly formated? Did I miss something else during the initialisation?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Geoffrey R.
  • 1,907
  • 1
  • 19
  • 32

0 Answers0