2009-09-05 06:51 PM
SDIO + FAT16/FAT32
#microsoft:-broken-for-sure2011-05-17 03:54 AM
New version!
This time, it simply works. Tested on STM3210E-EVAL. Read the first 512 bytes of a file named ''WVO.TXT'' on the card, then write it back over ''WRTEST.TXT''. Just note that it reads/writes 512 bytes at a time, and outputs various debug infos on USART1 at 112500,N,1 using printf(). I'm going to test the transfer speeds of this, and report back. Have fun! -Jerome Marchand, Aka Relaxe2011-05-17 03:54 AM
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 regards2011-05-17 03:54 AM
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 Oska2011-05-17 03:54 AM
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!2011-05-17 03:54 AM
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! -Relaxe2011-05-17 03:54 AM
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. :(2011-05-17 03:54 AM
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 Regards2011-05-17 03:54 AM
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.2011-05-17 03:54 AM
Oh, didn't know that.
Perhaps I unplugged the board temporarily, but I can't remember. Hm...2011-05-17 03:54 AM
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?