Page 1 of 1

STM32F7 trouble getting SDMMC to work

Posted: Thu Aug 22, 2019 7:07 pm
by mattf
Hi, I'm trying to get started on a project using chibios running on a Nucleo144-F767. I am using chibistudio with GCC 7.0 and chibios191.

I am trying to get SDMMC working on this board. I started with the main.c code from the STM32F4-SDC project, and modified it for the nucleo board (changed the serial interface, changed the LED pins etc.)

In order to get SDMMC working, I set HAL_USE_SDC to TRUE in halconf.h,

Code: Select all

#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC                         TRUE
#endif

and set STM32_SDC_USE_SDMMC1 to TRUE in mcuconf.h.

Code: Select all

#define STM32_SDC_USE_SDMMC1                TRUE

Then in main.c before sdcStart() I manually configure the SDMMC pins for alternate mode 12:

Code: Select all

/*
   * Manual pin setup for SDMMC since board.h isn't updated yet
   */
  palSetPadMode(GPIOC, GPIOC_SDMMC_D0, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );
  palSetPadMode(GPIOC, GPIOC_SDMMC_D1, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );
  palSetPadMode(GPIOC, GPIOC_SDMMC_D2, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );
  palSetPadMode(GPIOC, GPIOC_SDMMC_D3, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );
  palSetPadMode(GPIOC, GPIOC_SDMMC_CK, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );
  palSetPadMode(GPIOD, GPIOD_SDMMC_CMD, PAL_STM32_ALTERNATE(12) | PAL_STM32_OSPEED_HIGHEST );

  /*
   * Initializes the SDIO drivers.
   */
  sdcStart(&SDCD1, &sdccfg);


When I run the sdc test, it times out trying to connect to the SD card. I don't see any SDMMC pin activity on the oscilloscope either. I am clearly missing something obvious. Is there any demo code for using SDMMC on the F7?

Thanks in advance for any suggestions.

-Matt

Re: STM32F7 trouble getting SDMMC to work

Posted: Thu Aug 22, 2019 8:57 pm
by Giovanni
Hi,

/demos/RT-STM32-LWIP-FATFS-USB includes a builder for the STM32F746-Discovery.

Giovanni

Re: STM32F7 trouble getting SDMMC to work

Posted: Thu Aug 22, 2019 11:19 pm
by mattf
Thanks for the reply.
I reviewed the config for that project, and it seems to line up with I was trying.

Thanks,

-Matt