Skip to main content
Visitor II
August 13, 2020
Question

SDMMC1 working in 4bits mode with FatFS STM32H743

  • August 13, 2020
  • 2 replies
  • 1133 views

Hello,

I am trying to use a µSD card with a nucleo-h743zi2card. I use SDMMC1 peripheral and FatFS middleware.

When I set SDMMC1 in 1 bit mode my program works perfectly, but when I set the peripheral in 4 bits mode the card is not mounted.

When I debug in step by step mode I see that I have the RX_OVERRUN flag on. I tryed to enable the hardware flow controle (as it is said in AN5200) to solve this but when I do it nothing is writen on the SD card (I use f_write() function). I also try to set a clock divider and I have the same error in step by step debugging or I have FR_NOFILESYSTEM result when I step over f_mount() function.

I saw on other post on the same topic that some people have a sdmmc.c file generated but I don't have it, thus I don't know where the SDMMC1 gpio are set.

According to CubeMx my Gpios are set like it :

0693W000003PFFXQA4.jpg

SDMMC1 clock is set to 48 MHz.

I use CubeMx 5.6.1 (I can't use last version currently) to generate the project and I use ADC1 in the same code.

Do you have any idea to solve this matter ?

Thanks in advance :beaming_face_with_smiling_eyes:

    This topic has been closed for replies.

    2 replies

    Visitor II
    August 15, 2020

    Hello,

    I am having a very similar problem did you manage to solve it?

    Thanks!

    Graduate II
    August 15, 2020

    Might want to remove SB116/SB117 to remove stubs

    This is a working 4-bit demo, it reports progress via the VCP UART at 115200 baud

    I'm not a CubeMX / CubeIDE user so can't speak to the efficacy of their code.

    //
    // NUCLEO-144 SDIO/SDMMC
    // CN8
    // NC PC8 (D0) Remove SB116/SB117 stubs for PC8/PC9 on CN12
    // IOREF PC9 (D1)
    // RESET PC10 (D2)
    // (3V3) 3V3 PC11 (D3)
    // 5V PC12 (CLK)
    // (GND) GND PD2 (CMD)
    // GND PG2 (CS)
    // VIN PG3 (WP)
    //
    // SOCKET (VIEWTOOL)
    // VCC 3V3
    // GND GND
    // D0 PC8
    // CMD PD2
    // CLK PC12
    // D3 PC11
    // D2 PC10
    // D1 PC9
    // CD PG2
    //

    M.CHNAuthor
    Visitor II
    August 17, 2020

    Hello Clive thank you for your help,

    I don't find SB117, SB116 on my board (I higher SB that I see is SB82), if you were talking about SB17/SB16, there are no resistors on these SB. I use your hex file to understand what happens on 2 different µSD ( 2Gb which was working in 1 bit mode before and SDHC 4Gb class 10 which was not working before because of dataTimeout error during th SendStatus() function).

    On the photo the 4Go µSD seems to work with your hex file ( in highlighted in black ). Thus I really don't understand why it is not working with Cube.0693W000003PQUiQAO.jpg0693W000003PQV7QAO.jpgWhen I try with the 2Gb card it works too :

    0693W000003PQWoQAO.jpg

    0693W000003PQWtQAO.jpgHow did you configure your SDMMC peripheral ? What software do you use to program your card ?

    **Edit 1**

     I created a new project with 200 MHz for sdmmc1 with a clock divider of 2 (SDMMC_CLK should be at 50MHz like in your hex file). 4 bits mode seems to work now with 2Gb card (with hardware flow controle set to 1 to avoid RXOverrun error in send status function) but I still have a data timeout error in send status function for the 4Gb card.

    **********************************

    Thanks

    Mathieu