This is my board.h I think it is correct..
I think that I do get a responce as it hits this..
*resp = SDIO->RESP1;
HAL_SUCCESS;
Then cannot detect card..
stm32f4 SDIO setup
Moderator: RoccoMarco
-
daviddawe1982
- Posts: 94
- Joined: Thu Apr 11, 2013 10:35 am
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32f4 SDIO setup
How can I tell if it is correct? it is correct if it matches your board.
Just a note about board files, those are not written/modified, board files are generated by an utility included in ChibiStudio starting from XML files with .chcfg. Using the generator ensures that the file are at least formally correct.
Search .chcfg in the forum and details will pop up.
Giovanni
Just a note about board files, those are not written/modified, board files are generated by an utility included in ChibiStudio starting from XML files with .chcfg. Using the generator ensures that the file are at least formally correct.
Search .chcfg in the forum and details will pop up.
Giovanni
-
daviddawe1982
- Posts: 94
- Joined: Thu Apr 11, 2013 10:35 am
Re: stm32f4 SDIO setup
So after a bit more work I have got the sd to connect and mount but now i get this error.
FR_DISK_ERR.
What could be causing this?
My Test Code.
FR_DISK_ERR.
What could be causing this?
My Test Code.
Code: Select all
sdcObjectInit(&SDCD1);
sdcStart(&SDCD1, &sdccfg);
gdispClear(Black);
FIL file;
uint8_t teststring[] = {"This is test file\r\n"};
uint32_t bytes_written;
if(SDCD1.state == BLK_ACTIVE) {
sdcConnect(&SDCD1);
chThdSleepMilliseconds(100);
line1 = "Connected.";
gdispFillStringBox(0, (fheight1*3), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}
if (SDCD1.state == BLK_READY){
if(f_mount(0, &SDC_FS) == FR_OK) {
line1 = "Mounted.";
gdispFillStringBox(0, (fheight1*4), widthB, fheight1, line1, font1, White, Black, justifyCenter);
FRESULT err = f_open(&file, "test.txt", FA_WRITE | FA_OPEN_ALWAYS);
if( err == FR_OK) {
line1 = "File OK.";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
f_write(&file, teststring, sizeof(teststring), (void *)&bytes_written); f_close(&file);
f_close(&file);
}else if(err == FR_INVALID_NAME){
line1 = "FR_INVALID_NAME";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}else if(err == FR_NO_FILE){
line1 = "FR_NO_FILE";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}else if(err == FR_DENIED){
line1 = "FR_DENIED";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}else if(err == FR_DISK_ERR){
line1 = "FR_DISK_ERR";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (1) A hard error occured in the low level disk I/O layer */
}else if(err == FR_INT_ERR){
line1 = "FR_INT_ERR";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (2) Assertion failed */
}else if(err == FR_NOT_READY){
line1 = "FR_NOT_READY";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (3) The physical drive cannot work */
}else if(err == FR_NO_PATH){
line1 = "FR_NO_PATH";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (5) Could not find the path */
}else if(err == FR_EXIST){
line1 = "FR_EXIST";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (8) Acces denied due to prohibited access */
}else if(err == FR_INVALID_OBJECT){
line1 = "FR_INVALID_OBJECT";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (9) The file/directory object is invalid */
}else if(err == FR_WRITE_PROTECTED){
line1 = "FR_WRITE_PROTECTED";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (10) The physical drive is write protected */
}else if(err == FR_INVALID_DRIVE){
line1 = "FR_INVALID_DRIVE";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (11) The logical drive number is invalid */
}else if(err == FR_NOT_ENABLED){
line1 = "FR_NOT_ENABLED";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (12) The volume has no work area */
}else if(err == FR_NO_FILESYSTEM){
line1 = "FR_NO_FILESYSTEM";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (13) There is no valid FAT volume */
}else if(err == FR_MKFS_ABORTED){
line1 = "FR_MKFS_ABORTED";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (14) The f_mkfs() aborted due to any parameter error */
}else if(err == FR_LOCKED){
line1 = "FR_LOCKED";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (16) The operation is rejected according to the file shareing policy */
}else if(err == FR_NOT_ENOUGH_CORE){
line1 = "FR_NOT_ENOUGH_CORE";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (17) LFN working buffer could not be allocated */
}else if(err == FR_TOO_MANY_OPEN_FILES){
line1 = "FR_TOO_MANY_OPEN_FILES";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (18) Number of open files > _FS_SHARE */
}else if(err == FR_INVALID_PARAMETER){
line1 = "FR_INVALID_PARAMETER";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
/* (19) Given parameter is invalid */
}else{
line1 = "File OK.";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
err = f_write(&file, teststring, sizeof(teststring), (void *)&bytes_written);
if (err != FR_OK) {
line1 = "File BAD.";
gdispFillStringBox(0, (fheight1*5), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}
}
}else {
line1 = "Mount Fail.";
gdispFillStringBox(0, (fheight1*4), widthB, fheight1, line1, font1, White, Black, justifyCenter);
}
}- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32f4 SDIO setup
Hi,
Could still be I/O setup problems, check the data lines of SDIO. Long wiring could be another reason.
Giovanni
Could still be I/O setup problems, check the data lines of SDIO. Long wiring could be another reason.
Giovanni
-
daviddawe1982
- Posts: 94
- Joined: Thu Apr 11, 2013 10:35 am
Re: stm32f4 SDIO setup
Well I think you are right it must be my interface as I switched to the spi interface I had on the back of my LCD and it worked perfectly I have ordered a prebuilt sdio interface I will wait for it to arrive and try again.
Thank you for all your help.
Thank you for all your help.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32f4 SDIO setup
This happened already, long wires or lack of terminations, it can be critical.
Giovanni
Giovanni