cancel
Showing results for 
Search instead for 
Did you mean: 

Elm Chan FatFS problem - fs (Type: FATFS) only contains zero values

bernhard
Associate II
Posted on November 29, 2013 at 13:04

Hey everybody,

I'm having a hard time figuring out what the problem is. SPI seems to be working, disk_initialize(0) returns FR_OK and f_mount(0,&fs) returns FR_OK as well.

Problem is, that when I call

f_open(&fin, ''olimexino.txt'', FA_WRITE | FA_OPEN_ALWAYS | FA_READ)

the returnvalue is FR_NO_FILESYSTEM. I tracked the origin of the error, and the problem occurs in the check_fs()-function at the following line

if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)

so 2 is returned.

The reason for this is, that every value in the fs-pointer is zero.

I feel like I forgot some kind of initialization? But I wasn't able to figure out why this happens exactly. I had FatFS up & running on other systems just fine. In this application I'm using a STM32F103BG (part of Olimexino-STM32)

Any help would be appreciated! Thank you very much in advance

#zero #fatfs
3 REPLIES 3
Posted on November 29, 2013 at 13:36

Suggest you start by validating disk_read() in diskio.c, what blocks it's being asked to read, and what actually gets read into memory. Check also if there are any PARTITION related settings in the code. If the stack is adequately large, and if the static structures within FatFs are being initialized as expected by the C run time code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bernhard
Associate II
Posted on November 29, 2013 at 17:58

You are a m&!§)§f)''§(ng genius! If you should ever be in munich: I owe you a drink.

Thanks clive!

For the rest of the world: During the disk_read() I realized, that the write_block didn't do what the method was supposed to do.

nigude
Associate
Posted on August 31, 2014 at 21:25

Hi menecken,

I am facing same issue. Could please share what changes you have made ?