2018-06-14 12:48 AM
I am using stm32F411RE discovery kit. i generate a code with the cubeMX4.25, the 4GB SDHC card is working fine but when i tried with the 256MB SD Card it was not working. I am getting error 'FR_NOT_READY' in f_mount function.
Other SD Cards (4GB and 16GB) are successfully mounted and file can be written/read.
#fatfs-sdio #sd-card #fr_not_ready #f_mount-sdcard #sdio-fatfs #stm32f4-sdio #stm32f411e-disco #f_mount2018-07-01 07:35 AM
I have a 1GB Lexar that isn't recognized by the current code, seems to be a card version vs supported commands issue.
Older code example worked
FatFs Testing for asr.ahmed STM32 Forum
D--- 0 /DIRTYVGSD--- 0 /NAVMAN---H 0 /IGNORE~1D--- 0 /INXS---- 375802 /200705~1.NS1---- 834890 /200705~2.NS1---- 25 /LOG.TXT---- 0 /DIR.TXTDoneSTM32 1024 KB FLASH, 192 KB RAM, 003A003D-32314717-32303538 UNIQUESYS:42000000, H:42000000, P1:42000000, P2:42000000CPU:42000000, SDIO:48000000,24000000CRC32 37C5E7F8 Memory Image32768000 Bytes, 231096262 Cycles5.955336 MBps Write (FatFs)CRC32 37C5E7F8 SPEEDTST.BIN32768000 Bytes, 226991312 Cycles6.063034 MBps Write (FatFs)CRC32 37C5E7F8 SPEEDTST.BIN32768000 Bytes, 184919968 Cycles7.442441 MBps Read (FatFs)32768000 Bytes, 184899499 Cycles7.443265 MBps Read (FatFs)Done2018-07-02 11:13 AM
I ordered a couple of these to see if anything special/odd about them.
Did you get the PM with the suggested code change need for the 1GB card. The 2GB card (SD) worked without changes, as did the 4GB card (SDHC)
Ended up wiring up a new socket to the F4-DISCO, and testing with that on both SPL and HAL code bases
2018-07-23 01:35 PM
Hello,
I am following up on this question as it is still not solved.
We are not able to support 256MB SD CARD. Please see below.
We are using stm32F411RE discovery kit. The code was generated with the cubeMX4.25. This code is supporting 4GB and 16GB SDHC card but 256MB SD Card does't work. We are getting error 'FR_NOT_READY' in f_mount function.
Please suggest if there is a patch or old revision of code that can support 256MB card?
2018-08-01 06:47 AM
Hello,
I would like to update the current status of the issue. We have three 256MB cards and out of three cards one card is working perfectly with the firmware. One card gives an error FR_NO_FILESYSTEM and another one gives an error FR_DISK_ERR.
We check into the lower level functions of FatFs and it gets error from below function.
File Name : ff.c
Function Name: FRESULT find_volume
bsect = 0;
fmt = check_fs(fs, bsect); /* Load sector 0 and check if it is an FAT-VBR as SFD */
if (fmt == 2 || (fmt < 2 && LD2PT(vol) != 0)) { /* Not an FAT-VBR or forced partition number */
for (i = 0; i < 4; i++) { /* Get partition offset */
pt = fs->win + (MBR_Table + i * SZ_PTE);
br[i] = pt[PTE_System] ? ld_dword(pt + PTE_StLba) : 0;
}
i = LD2PT(vol); /* Partition number: 0:auto, 1-4:forced */
if (i) i--;
do { /* Find an FAT volume */
bsect = br[i];
fmt = bsect ? check_fs(fs, bsect) : 3; /* Check the partition */
} while (LD2PT(vol) == 0 && fmt >= 2 && ++i < 4);
}
if (fmt == 4) return FR_DISK_ERR; /* An error occured in the disk I/O layer */
if (fmt >= 2) return FR_NO_FILESYSTEM; /* No FAT volume is found */
The values in br[] array in working 256MB Card is {0x65, 0x00, 0x00, 0x00}
The values in br[] array in non-working 256MB Card is {0x3F, 0x00, 0x00, 0x00}
So, We searched and found that these numbers are indicating the number of hidden sectors of the SD Card.
after executing the do_While loop the fmt was fed with 4 and 3 in non-working cards.
Should we Check for any other possible area? Can 0x65 and 0x3f make a difference?
2018-08-01 07:23 AM
The cards I got needed some more CMD55 requests to come up.
The code shown is reading values from the MBR partition table, it uses these to find the BPB of the FAT volumes. The FR_NO_FILESYSTEM is indicative that it can't find a FAT volume at a specified location, the locations might be different depending on how they were formatted, and still be valid.
Are these cards readable elsewhere? ie from a PC based card reader.
A dump of the content of the MBR, and BPB might be more instructive about the issues with the card than the code that processes the data.
2018-08-01 10:54 PM
Hello,
We gave it the CMD55 until it did not return HAL_SD_ERROR_NONE So it give HAL_SD_ERROR_NONE after 3 or 4 tries.
all three cards are working in the PC. But only one card is work with the Discovery kit. all the cards are of KODAK brand.
All three cards are formatted with the FAT16 file system with the 16k and 4k Allocation unit size.
Please find attachment for the MBR Register values of all three cards.
2018-08-08 09:52 PM
Hello All,
I am working with Durmil,
To summarize again: we have three 256 MB SD Card of Kodak brand. Out of these three, only one 256 MB SD Card is working with 4-bit SDIO.
We found that using 4-bit SDIO, MBR sector is not read correctly from one SD Card. Till now it is observed that while reading MBR (located at sector # 0x3F) in this SD Card, 21st Byte's LSB 4-bits of are missed and replaced by next byte's MSB 4-bits. So, it affected bits of all next bytes to be shifted ahead. After some bytes, it again misses 4bits LSB. This happened almost 3-4 times for reading 512 bytes of MBR sector. Hence, CRC is not matching. So, it is giving FR_NO_FILESYSTEM as it has not found valid MBR.
We have tried using 1-bit SDIO with this non-working SD Card and it works fine! Now all three 256 MB SD Cards are mounted, opened and file can be created with with some text using 1-bit SDIO.
So, now question comes - cannot all 256 MB SD card work via 4-bit SDIO? Should we use only 1-bit SDIO for 256 MB SD Card to make sure that our firmware will communicate successfully with all 256 MB SD Card?
FYI: 16 GB is working via 1-bit SDIO and 4-bit SDIO.
We still prefer to use 4-bit SDIO, if we can found reason and solution. If not, we have option of 1-bit SDIO.
Thanks and Regards.
2018-08-08 10:20 PM
Dump CID, CSD and SCR for the various cards.
SCR should flag available bus widths.
2018-08-12 09:38 PM
Thanks Clive.
Here are Details of CID, CSD for all three 256 MB SD Cards:
Working SD Card
CSD: [0] 0x005ED032, [1] 0x5F5983CF, [2] 0xEDB6FF87, [3] 0x9640003E
CID: [0] 0x1B534D53, [1] 0x4D492020, [2] 0x1002B866, [3] 0xCF0079C8
SD Card with NO_FILESYSTEM Error:
CSD: [0] 0x00260032, [1] 0x5F5983C4, [2] EDDACFFF, [3] 0x92404060
CID: [0] 0x03534453 [1] 0x55323536, [2] 0x800008B6, [3] 0x12007CB0
SD Card with DISK_ERR:
CSD: [0] 0x00260032, [1] 0x5F5981E1, [2] 0xB6DB7F81, [3] 0x964000FA
CID: [0] 0x18494E32, [1] 0x35364D42, [2] 0x2540CC85, [3] 0x05006B94
We could not find SCR, but will try and let you know.
2018-08-27 02:17 AM
Hi @Community member
I have implemented SD Card activity using EXTI interrupt. I get interrupt when I insert or remove the SD Card. But in my case, when I remove and again insert the SD Card, f_mount fails. It returns DISK_ERR. First time it mounts perfectly and read data correctly. But mounting second time and onward, it creates problem.
I cannot figure it out the reason.