STM32F7 trouble getting SDMMC to work

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

Moderator: RoccoMarco

Post Reply
mattf
Posts: 2
Joined: Thu Aug 22, 2019 5:10 pm

STM32F7 trouble getting SDMMC to work

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F7 trouble getting SDMMC to work

Post by Giovanni »

Hi,

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

Giovanni
mattf
Posts: 2
Joined: Thu Aug 22, 2019 5:10 pm

Re: STM32F7 trouble getting SDMMC to work

Post 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
Post Reply