STM32F746G-DISCO microSD Card Issues Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

jtrug
Posts: 2
Joined: Fri Sep 13, 2019 6:24 pm

STM32F746G-DISCO microSD Card Issues  Topic is solved

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

Hi,

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");
    }
    else{
      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);
    }

    f_close(&fil);
    chprintf(chp, "done writing");


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

Thanks,
Attachments
hello.zip
Results of SD Card Testing Good and Bad
(348 Bytes) Downloaded 7 times

User avatar
Giovanni
Site Admin
Posts: 12404
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 612 times
Been thanked: 519 times
Contact:

Re: STM32F746G-DISCO microSD Card Issues

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

Hi,

Have you checked for possible stack overflows?

Giovanni

jtrug
Posts: 2
Joined: Fri Sep 13, 2019 6:24 pm

Re: STM32F746G-DISCO microSD Card Issues

Postby jtrug » Mon Sep 16, 2019 2:23 pm

Thanks that solved my issue. Going into the makefile and increasing the stack size of the main thread fixed all my write issues.

Appreciate the quick help!


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 0 guests