2018-02-13 04:22 AM
Hi
I'm having quite an issue while using the FatFs on a SD card.
I configure everything on the Cube following this tutorial :
I'm kinda lost, and i would like some support or some clues to go deeper and make it work.I'm not planning on using an SPI connection but the SDMMC proposed by CubeMx.For now only the initialisation doesn't return errors. any other functions lead me to differents error.I can some documents if needed hope some of you could help me.thanks in advance#stm32h7-sdmmc #stm32h72018-02-13 05:30 AM
Hi
jean_camille.lebreto
,Did you tried using the examples available in the STM32CubeH7 package?
You find examples using both FatFS and µSD underSTM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Applications\FatFs.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-02-13 07:30 AM
In fact i did !
To give some more information :
I'm actually working on a Nucleo-STM32H743ZI, and have no µSDport on it. (no Shield)I'm trying yo use 1wire SD
I'm using standard wire and pull ups resistor (43kOhm) on pin CMD and D0At the moment the function :
BSP_SD_INIT();
but anyother functions from FatFs doesn't work! for exemple f_mount return error FR_NOT_READYI'm starting to think that my issue is purely hardware (connection, pull up, wrong pinout etc...) I'm investigating and gonna try on the STM32F7-eval board.2018-02-13 09:29 AM
Not ready suggests you have code in there looking for the socket's Card Detect pin.
Should be trivially easy to wire a full 4-bit SDIO from a NUCLEO-144, along with a GPIO for Card Detect
3V3 Socket socket here
VCC - 3V3
GND - GND
D0 - PC8
CMD - PD2
CLK - PC12
D3 - PC11
D2 - PC10
D1 - PC9
CD - GPIO PG2 or PG3 close
2018-02-13 09:57 AM
The EVAL example is dependent on a card detect pin attached to the MFX chip, the NUCLEO-144 example uses the AdaFruit SD SPI implementation, which have a flaw in the multi-sector code, and a method deleterious to performance (25-30% slower)
STM32Cube_FW_H7_V1.2.0\Projects\STM32H743ZI-Nucleo\Applications\FatFS\FatFS_uSD_Standalone
2018-02-19 03:36 AM
oh!
I see my mistake now... Indeed the FatFs_uSD_Standalone test program use the SPI bus and not the SDMMC... It's now working with the SPI wich is OK for the moment! if you have any other ideas to make the SDMMC working i'll be pleased to receive them! Thanks for your help! it was the last part i was looking for in order to end a project!2018-02-23 11:40 AM
I have one SanDisk card that isn't working on the H7 implementation, works fine on the F7 and L4 though. I need to dig deeper into the command/software side to see if it is doing something different. There is a lot of code in there related to higher-speed modes and 1.8V/3.3V level converters and such
2018-02-28 03:47 AM
for my part any class 10 SD card works fine
Only a common SD card from sanddisk doesn't work But i got the error ofFR_NO_FILESYSTEM.
2018-02-28 04:27 AM
2018-06-05 11:29 PM
My experience with SDMMC1 on STM32H7 NUCLEO:
1. make sure the ClockDivider is not too small (with flying wires, I use hsd1.Init.ClockDiv = 96;(try a bit, I saw that CMDs on SDIO can fail if too fast)
2. check what is the PCLK soure (where to get the SDMMC clock from):
what is the PCLK source and frequency? I use PLL1 (PLL2 seems to fail for SDMMC1)
3. Make sure, all the memory and buffers used by SDMM1 are really
just on AXI SRAM
(D1).SDMMC1
cannot
access all memories, e.g. not D2 or D3! (see the bus matrix in datasheet). Check your linker script where .data, .bss will be linked.4. When you have caches enabled, you use DMA - make sure to configure MPU, to use cache maintenance
functions (Clean and Invalidate)
I had similar issues to bring up SDMMC1 and FatFS but my main faults where these:
a) SDMMC1 tried to use D2 or D3 buffers - DMA engine will hang, FatFS will see garbage ...b) caches used but not properly updated for 'non-coherent' DMA (even all data was transferred by DMA - the MCU (FatFS) sees still the old cache content, e.g. MBR, FAT does not look reasonable for FatFS because cache was not updated (or when writing you corrupt the filesystem on SDCard!)So, check caches, cache policies and maintenance and where are all the buffers (used by FatFS) are located and if SDMMC(1) can really access these memories (just AXI SRAM, D1).
It works fine for me now after fixing these issues.