2023-12-20 08:28 AM
Hello,
I'm trying to set up a micro sd on a nucleo-u575ZI through the sddmc1 with a port of FatFs.
I am using a PmodMicroSD all wired up for 4 bits and the card detect on a GPIO.
I am testing 3 sd card 16GB, 32GB and 64GB.
I have confirmed that all 3 are working in 4 bits mode though SDMMC on a STM32L4R9I Discovery with FatFs.
My current implementation on the U575 works only in 1 bit mode. All 3 cards are working and ExFat is enabled on FatFs and I can read and write files no problems.
When I change the SDMMC to 4 bits configuration on the U575 only the 16GB sd card works. The other cards gives me a FR_NO_FILESYSTEM when trying to mount.
I believe it comes from this line in ff.c
if (fmt >= 2) return FR_NO_FILESYSTEM; /* No FAT volume is found */
I'm a bit loss and I was wondering if anyone had any ideas what might go wrong. I ported FatFs from the STM32L4 CubeMX generation. (FatFs version 0.12c) I believe FatFs has exFat bugs in 0.12C as state in the change logs of 0.13 but I am unsure if the bugs affect my issue. I think it's only a wrong configuration but that it's related to exFat.
Thanks
Solved! Go to Solution.
2023-12-20 09:52 AM - edited 2023-12-20 09:56 AM
So i think, its not about FatFs lib problem - its the hardware , as in most cases, when 1-bit works, but 4-bit not. :)
Whats the distance cpu - sdcard ? Both on your L4 + on U575 ; + pullups ? (maybe show a photo...)
2023-12-20 08:56 AM
It's a chronically old version of the library. Make sure _FS_EXFAT is enabled in ffconf.h
No file system is indicative of it not supporting whatever partition or volume is described in the MBR or BPB sector. Make sure it's reading those properly.
Older libraries had some integrity issues with the larger volumes, but the issue was more subtle.
2023-12-20 09:03 AM
_FS_EXFAT is enabled for the U575.
What is confusing is that the same library is working flawlessly on the STM32L4, same clock speed, same configuration.
Why would changing from 4 bit to 1 bit read brake the MBR reading. Because the cards with exFat enabled are working in sdmmc 1 bit mode.
2023-12-20 09:52 AM - edited 2023-12-20 09:56 AM
So i think, its not about FatFs lib problem - its the hardware , as in most cases, when 1-bit works, but 4-bit not. :)
Whats the distance cpu - sdcard ? Both on your L4 + on U575 ; + pullups ? (maybe show a photo...)
2023-12-20 11:18 AM - edited 2023-12-20 11:20 AM
In 4-bit mode signal integrity and relative skewing become issues.
Watch for all pins on the Nucleo being available, and not contending with other peripherals and headers, and circuit stubs. Remove stubs where solder bridges are available to do so.
1-bit / SPI modes being more robust as a individual pins for In, Out and Clock.
Check data read in via DISKIO for the two cases, perhaps CRC or checksum in a way that you can easily instrument, and confirm it is reading the data correctly. If you can't read data back correctly / reliably, the file system is going to fail, or damage the data integrity moving forward.
2023-12-21 12:33 AM
This seems to have been my problem. For the sake of completion here is the before and after if it can help anyone decide on the lengths of cable for prototyping ;)
I'm using the PmodMicroSD which has pull up resistors as so:
The L4 discovery had already a soldered sd card reader.
Before
After