STM32F746G-DISCO microSD Card Issues

Report here problems in any of ChibiOS components. This forum is NOT for support.
Posts: 1
Joined: Fri Sep 13, 2019 6:24 pm

STM32F746G-DISCO microSD Card Issues

Postby jtrug » Fri Sep 13, 2019 7:04 pm


Board: STM32F746G-DISCO
Version: Chibios 17.6,18.2.2,19.1.3
Compiler: GCC 7.0 (Windows ChibiStudio)

I am trying to write to the microSD on my F7 discovery board with FatFS. Whenever using 18.2 or 19.2 I get consistent but periodic garbage on the output. See attached hellobad.txt for an example. I rolled back to the 17.6 and the same code produced no problem at all. See hello3good.txt for example of it.

In each case I take the demo included with Chibios and change the configuration to enable sd card and serial and then nothing else. The code I am using for my test is included below.

Code: Select all

    sdStart(&SD1, NULL);

    static BaseSequentialStream* chp = (BaseSequentialStream*)&SD1;

    if (!blkIsInserted(&SDCD1)) {
      chprintf(chp, "Card not inserted, aborting.\r\n");
      chprintf(chp, "Card is inserted.\r\n");

    chprintf(chp, "Connecting... ");

    if (sdcConnect(&SDCD1)) {
      chprintf(chp, "failed\r\n");

    FATFS fs;           /* Filesystem object */
    FIL fil;            /* File object */
    FRESULT res;        /* API result code */
    UINT bw;            /* Bytes written */

    f_mount(&fs, "", 0);
    res = f_open(&fil, "hello4.txt", FA_CREATE_ALWAYS | FA_WRITE);
    for (int i = 0; i < 200; ++i) {
      f_write(&fil, "Hello, World!\r\n", 15, &bw);

    chprintf(chp, "done writing");

Anyone have any idea what could be different or the problem?

Results of SD Card Testing Good and Bad
(348 Bytes) Not downloaded yet

User avatar
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times

Re: STM32F746G-DISCO microSD Card Issues

Postby Giovanni » Fri Sep 13, 2019 8:54 pm


Have you checked for possible stack overflows?


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 0 guests