2012-06-30 02:43 PM
Hello,
i have a small problem i think.With the help of this forum and google i created a project with CoIDE.What it should do is reading the directory of an SDCARD.The SDCARD part is working. but the fatfs is not working and i don't know what i'm doing wrong. I believe everything is oke. so i hope someone could help me. I attached the whole project. #sdcard-stm32f4-sdio-fatfs2012-07-05 10:12 AM
it was a connection error in the addapter, i replaced it and the sd card is working again.
even when switching to 4b data mode [code]Status = SD_EnableWideBusOperation(SDIO_BusWide_4b);[/code]this goes also well, it returns no error [code]res = f_mount(0, &fs);[/code]but when running this code i get a fr_no_filesystem[code] DIR dirs; char path[50]={''''}; res=f_opendir(&dirs, path);[/code]the code above i found on the internet. you use printf, but i don't have a serial connection to my discovery board.could someone help me more, i think SD card with resistors is working. since it could switch to 4b mode.2012-07-05 10:38 AM
i did some debuging.
and find out that fmt = check_fs(fs, bsect = 0); gives 2not a boot record, but how can i put a bootrecord on a sdcard. it is formated as fat, it's a 2Gb card.what could i do next to solve this problem.2012-07-06 09:54 AM
If the media is readable on a PC, it should be readable here. For this type of media a MBR (Master Boot Record) is optional, and the FAT file system could exist with, or without, a partition table.
The way to effectively test this stuff is to connect the SDCard to the USB via the Mass Storage Controller. That should work, and if it doesn't it's a pretty sure indicator that something else is wrong. Running CHKDSK on the media is also good at verifying integrity. Formatting, either via the Media Properties, or Disk Manager. Dumping out the content of the first sector should be instructive as to whether things are reading properly.2012-07-06 10:25 AM
How can i read sector 0 ?
if i use SDBlockread and use adres 0 is this sector 0. I searched google, but could not find any help on this problem.2012-07-06 11:17 AM
Please refer to the disk_read() code I've posted earlier, and the USB MSC package.
Sector 0 is at offset 02012-07-06 12:17 PM
i altered it in diskio.c
i think BLOCKSIZE should be 512.but now it keeps waiting on Status = SD_WaitReadOperation(); // Check if the Transfer is finishedso it looks like it could not complete the readoperation. how can i check that. and what should i expect after doing this Status=disk_read(0,buffer2,0,1);what should be in buffer2 ?2012-07-06 04:20 PM
BLOCKSIZE is 512 and was defined in your original code.
Sounds awfully like you're not handling the interrupts for the SDIO library properly./**
* @brief This function handles SDIO global interrupt request.
* @param None
* @retval None
*/
void SDIO_IRQHandler(void)
{
/* Process All SDIO Interrupt Sources */
SD_ProcessIRQSrc();
}
2012-07-07 10:05 AM
Clive,
I'm still stuck at the above line. i think i turned on Interupt, but i don't now if i did it right. Could you look in to the attached code ? is stm32xxx_it by default loaded or do i load it manualy ? this because of the interupt handler. ________________ Attachments : LCD_SD.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtU9&d=%2Fa%2F0X0000000aQg%2FKF1_t1i2dJ8scXb69hsvwAgtQePc6kUFqdTLSVMvAeI&asPdf=false2012-07-07 04:39 PM
CooCox is not my IDE, but try to see if this builds.
________________ Attachments : LCD_SD_Rev2.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtWX&d=%2Fa%2F0X0000000aRF%2F.B2UetsQznJJ3_lT.zycwQsnpE8bQt1v7GatmAP91js&asPdf=false2012-07-08 04:14 AM
I just flashed the board with your example project
stm32f4_discovery_msc_sdhc_release_1there was a bin file inside. With this example running, i can read the sd card with my computer. So everything is connected well.Your rev2 code at the end of this post isn't working, the program is hanging at the same point again. So i have to figure out where it goes wrong.With what kind of compiler do you work ?