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

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

    Hi relaxe,

    This project is prepared for ST forum users. Original project is done by

    user name ''newnesr''. I have just move it from IAR into RIDE7 IDE.

    Program prints all files in main directory of SD card through USART1.

    I have also give my own function to format FAT row name into user interface string,

    so check it before use it. I have also moved hardware interface form library source

    into separate file. I've changed graphic LCD into USART1.

    Hardware connection is SPI2 on PB12,13,14,15 on STM32F103ZET6.

    Have fun

    Jaroslaw Oska

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

    Hi everyone,

    I hope you can help me.

    I got likely the same problem as relaxe:

    At the end of function SD_ReadBlock in sdcard.c, after the interrupts are set, a hard fault exception occurs.

    No idea why and how I can avert this.

    It seems that a SD_RX_OVERRUN is happening immediately.

    At least I can see the right data in memory view at the readbuffer's position, thus the communication is working correctly.

    But why the hard fault exception?!

    I'm using a STM3210E-EVAL board with a STM32F103ZET6 and Ride 7.

    Thanks for attention,

    Best regards

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

    Hi,

    thanks for the answer, but I used version 2 of your code and there the buffer is already declared as static.

    Furthermore the data is correctly read out, as I already mentioned. :(

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

    Weird... my V02 code was working pretty ''straight out of the box''.

    I would like to mention I am no professional coder. I'm an hardware deigner who happens to have a clue about coding. I probably did many things wrong in the code I've posted. Please, if you find such errors/mistakes or simply have a good idea to improve the code, share it here so I can learn from my errors.

    That being said, if I were you, I would download/install and try the code with IAR 5.20. If it works, then I did something wrong but IAR detects and corrects it. If it does not work, then you probably do something wrong :p

    Can anybody else try the V02 code and come back here to report if it works for you.

    Thanks to all!

    -Relaxe

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

    My problems all went away when I declared my buffer as ''static''.

    Not sure why the compiler was trying to re-allocate it when it's declared in the main.c .... hope that helps!

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

    Oh, also, between various ''debug sessions'', you must remove the card, stop the board, replug the card, then start the board.

    'cause if you put your card in any state other than ''wait'', it will probably fail initialisation.

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

    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

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

    Oh, didn't know that.

    Perhaps I unplugged the board temporarily, but I can't remember. Hm...

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

    *sorry, double posting*

    [ This message was edited by: bhpclan on 26-01-2009 10:59 ]

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

    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