Skip to main content
mikewilliamson9
Associate II
September 6, 2009
Question

SDIO + FAT16/FAT32

  • September 6, 2009
  • 49 replies
  • 8123 views
Posted on September 06, 2009 at 03:51

SDIO + FAT16/FAT32

#microsoft:-broken-for-sure
    This topic has been closed for replies.

    49 replies

    vinicius_acvasconcelos
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    Quote:

    On 22-01-2009 at 16:42, Anonymous wrote:

    My situation is similiar to yours ;)

    Unexpectedly the communication with the SD card is now working perfectly.

    And I don't know what was the mistake, just like you.

    But strangely your source code still doesn't work for me.

    In my view there is no difference between my code and yours.

    So what... Let's forget about it :)

    The mistake in my code was, that I just forgot to enable the interrupts for SDIO. But nevertheless the symptoms were the same for both codes.

    In your code the initialization including setting up interrupts is totally correct, so this can't be the reason.

    Best Regards

    I have the same problem, the both codes doesn't work:-|. Go direct to the HardFault Exception. There is some code thats really works?

    stefan239955_stm1_stmicro
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    Hello,

    I have the STM3210E-EVAL board and try to run the code from the SDIO_DosFS_V2.zip example at the beginning of this thread.

    I can compile the code with Keil's uVision (RVMDK 3.15b) after commenting the asm code in the HardFaultException Handler.

    Although when running it, it doesn't do too much.

    I tried to debug it and got this result:

    http://dpaste.com/hold/113342/

    Without a breakpoint it just stops automatically at the ASM code of ''SDIO_DeInit:'' with this error:

    *** error 65: access violation at 0x40018000 : no 'write' permission

    If I step through the code from there on I get more but similar errors (see dpaste).

    I can continue stepping through the asm code until it gets stuck in ''SDIO_GetFlagStatus:'' at the command where the arrow (-->) is.

    At this point I've a lot of error messages (see dpaste).

    Anyone an idea? I've to admit I've not much knowledge about SDIO and I'm hoping to find a working solution without digging to deep into that technology and building it all from scratch.

    Thanks in advance

    -Stefan

    vinicius_acvasconcelos
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    Quote:

    On 26-01-2009 at 10:58, Anonymous wrote:

    Quote:

    I have the same problem, the both codes doesn't work:-|. Go direct to the HardFault Exception. There is some code thats really works?

    Hi, you could try to disable WideBusOperation.

    I recognized, that with WideBusOperation enabled I get a hard fault exception too.

    Furthermore try to use other DeviceMods than DMA, perhaps this works for you.

    Best regards

    I'm using SPI and EFS library, so the SDIO is disable, neither DMA.

    There are some how to make this works properly?

    vbenso
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    I'm having the same problem. The setup is very similar so I will skip its description. Any news on this issue?

    stefan239955_stm1_stmicro
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    It actually seems that my previous assumption was wrong, and that it was just counting down a huge counter, for which I had to go through every step.

    But now I think I got the position where it is stuck:

    Call stack:

    main()

    > DFS_ReadSector()

    > SD_ReadBlock()

    > CmdResp1Error()

    Line #2170 in sdcard.c

    while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)))

    {

    status = SDIO->STA;

    }

    ASM code:

    2170: while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)))

    2171: {

    0x0800200A E001 B 0x08002010

    2172: status = SDIO->STA;

    2173: }

    2174:

    0x0800200C 486D LDR r0,[pc,#436] ; @0x080021C4

    0x0800200E 6B47 LDR r7,[r0,#0x34]

    0x08002010 F0170F45 TST r7,#0x45

    0x08002014 D0FA BEQ 0x0800200C

    Anyone a suggestion?

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    Hello all!

    Sorry to be mute at the moment, but I'm quite occupied at other things.

    First, V02 works. For me at least!

    I'm not sure about why/how people around here are getting errors. I can just promise to dwelve into that very soon. I actually plan on getting back at it next week.

    We have used this code in our project, and have full FAT32 control over 16GB SD cards for audio streaming application. I may have tweaked a bit the lib since V02, and will just try to post the improvements (if any?).

    -Relaxe

    brunoalltest
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    There is

    http://www.stm32circle.com/projects/project.php?id=56

    on stm32circle.com with DosFS.

    Also, there is a

    http://www.stm32circle.com/forum/viewtopic.php?id=450

    about it in their forum.

    vladimir23
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    In example:

    Code:

    static uint8_t transferbuffer[SECTOR_SIZE];

    ...

    DFS_WriteFile(&fi, sector, transferbuffer, &cache, SECTOR_SIZE/2);

    why ''/2''? When I try to write

    Code:

    DFS_WriteFile(&fi, sector, transferbuffer, &cache, SECTOR_SIZE);

    hardfault exception appear

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    This topic is named : ''SDIO + FAT16/FAT32'', and I would like people to respect this simple fact. Please, people who implement a FAT lib over =SPI=, stop hijacking this topic.

    Now, if you just wonder what the heck I'm talking about:

    Most SD cards out there are mandated to respect compatibility with the SPI port. Most of the projects out there use the SPI port to acess SD Cards. The high-density line of STM32 have a SDIO port, wich is faster but different to implement. This topic is about interfacing a FAT library over that specific port: SDIO.

    Thanks,

    -Relaxe

    vinicius_acvasconcelos
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:54

    Quote:

    On 05-03-2009 at 13:51, Anonymous wrote:

    In example:

    Code:

    static uint8_t transferbuffer[SECTOR_SIZE];

    ...

    DFS_WriteFile(&fi, sector, transferbuffer, &cache, SECTOR_SIZE/2);

    why ''/2''? When I try to write

    Code:

    DFS_WriteFile(&fi, sector, transferbuffer, &cache, SECTOR_SIZE);

    hardfault exception appear

    You have the same promble then I. I tracked the hardfault exception, it's hapen when the fuction try to send to SPI a adress tha not fit in u16.

    There's an error in the calculation of FAT adress in this library. Anyone already solve this problem?