cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Setup USB-OTG-FS with Mass Storage Class on a STM32469 Discovery Board with CubeMX

Prajyot1
Associate III

hey @m.beddi , 
have you find the solution . i am struck at this too.

edit : to reformulate the issue

Issue description :

I am trying to implement the MSC_Standalone example (USB device mode with SD card) on the STM32469 Discovery board using CubeMX (with USB OTG FS mode).

  • USB initialization appears to work, but the SD card is not recognized or accessible.
  • The program hangs with a timeout error in the SD card command response function SDMMC_GetCmdResp1(), indicating that SD card commands are not completing successfully.
  • I suspect a timing or clock configuration issue, despite trusting CubeMX to handle this.
uint32_t SDMMC_GetCmdResp1(SDIO_TypeDef *SDIOx, uint8_t SD_CMD, uint32_t Timeout)
{
  uint32_t response_r1;
  uint32_t sta_reg;
  uint32_t count = Timeout * (SystemCoreClock / 8U / 1000U);
  do
  {
    if (count-- == 0U)
    {
      return SDMMC_ERROR_TIMEOUT;
    }
    sta_reg = SDIOx->STA;
  } while (((sta_reg & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CMDREND | SDIO_FLAG_CTIMEOUT)) == 0U) ||
           ((sta_reg & SDIO_FLAG_CMDACT) != 0U));
}

 

I would appreciate any advice or best practices on how to troubleshoot and resolve this issue, especially regarding clock configuration, SD card initialization, or CubeMX project setup. The complexity of clock and peripheral setup is overwhelming, so any guidance would be very helpful.

0 REPLIES 0