Skip to main content
Visitor II
February 9, 2012
Question

SDIO and SD fat access example?

  • February 9, 2012
  • 82 replies
  • 16079 views
Posted on February 09, 2012 at 01:06

Hi Chaps,

Going slowly mad trying to get Chan Fat working with the sdio libs on a stm32f4.

I'm using the most recent (1.0.0) library for the F4, and the low level access demo within that library builds and (at least appears to ) work OK. 

I've spent many, many hours attempting to patch in 0.9 version of fatfs from chan (thks chan, you're a hero) - but I can't get it to work.

If possible, I'd really really appreciate a demo project/source (or direction to - though I've scoured the web and can't find anything that works!)

I'll post separately about the current problems I'm having with the my current build, but a working example would sort it.

Many thanks,

nat.

#hse-sdio-stm32 #stm32-fat-chanfat-fatfs-sdio #sdcard-stm32f4-sdio-fatfs #sdcard-stm32f4-sdio-fatfs
    This topic has been closed for replies.

    82 replies

    Visitor II
    October 24, 2012
    Posted on October 24, 2012 at 09:03

    @Clive

    I have run your project.

    f_mount is returning 0 ( FR_OK)

    f_open is returning 1 (FR_DISK_ERROR)

    I debugged f_open() function and i have analyzed that in f_open() the call to check_mounted() function is returning 1 (FR_DISK_ERROR)

    Inside check_mounted() function vol is assigned 0 and then it skips the part under the comment //Check if the file system object is valid or not. Then the control goes to the part written under the comment //the following code attempts to mount the volume

    In this section disk_initialize() function is called and this function is returning 0(disk initialized successfully)

    After disk_initialization() function disk_ioctl() function is returning 1 (FR_DISK_ERROR).

    Visitor II
    October 24, 2012
    Posted on October 24, 2012 at 10:51

    disk_ioctl() function isn't returning any value.I checked the return value on UART but it is not displaying any value.

    Graduate II
    October 24, 2012
    Posted on October 24, 2012 at 17:12

    disk_ioctl() returns RES_OK

    You might want to confirm you can do the sector reads (via disk_read(), or equivalent), and verify you can read from the card. If that doesn't work independently, then FatFs will have bigger issues.

    Visitor II
    October 25, 2012
    Posted on October 25, 2012 at 07:32

    Ok i will get back to you after verifying disk_read() function........i checked f_unlink() function too but it isn't working.....I had been banging my head to figure out the problem since last week :(

    Visitor II
    October 25, 2012
    Posted on October 25, 2012 at 08:18

    disk_read() function is also returning 1 (not OK) ...... Can you give me code for direct disk_read() call?

    Graduate II
    October 25, 2012
    Posted on October 25, 2012 at 17:38

    unsigned char Buffer[512];

    disk_read(0, Buffer, 0, 1);

    Visitor II
    October 31, 2012
    Posted on October 31, 2012 at 11:18

    @Clive

    disk_read() is now functional i have made certain changes in the code and made it working...I have used SD_ReadSingleBlock() to check if this function can read sectors or not

    Now tell me the next step?

    I want to know the steps that are being followed while implementing FATFS as i don't know the A B C of FATFS....I really want to make my concepts clear as to how this library works and what are the steps that we must follow to implement this file system.

    Visitor II
    October 31, 2012
    Posted on October 31, 2012 at 11:22

    My ultimate goal is to store an image on SD Card....i would really appreciate if you give me some guideline on this as well

    Graduate II
    October 31, 2012
    Posted on October 31, 2012 at 15:26

    I'm not sure I want to be dragged into your project/work this deep, I think you can read the FatFs documentation/website and source as easily as I can. If you need to understand how it works you'll need to study it.

    Visitor II
    November 2, 2012
    Posted on November 02, 2012 at 06:27

    Thanks alot for guiding me :)