cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H745I-DISCO FatFs_Shared_Device example doesn't work.

woozl
Associate II

Example builds, but serial terminal reads:

[CM7]:	Creating FileSystem...
[CM7]:	Creating FileSystem Failed!...
[CM7]:	Error!! 

Is there an example of eMMC fatfs that works?

8 REPLIES 8

Built stuff for these boards that does work, output via ST-LINK VCP at 115200 8N1

Not sure I'd start with both CM4 and CM7 cores running the eMMC. Depending on compiler polling will probably fail at around 30-33 MBps in 8-bit mode. Would definitely want to be using DMA.

https://github.com/cturvey/RandomNinjaChef/blob/main/STM32H745I_DISCO_eMMC/H745I_DISCO_8BIT_DDR.hex

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hey, thanks for all your help on the forum, I've seen your name quite a few times, your posts are always super useful as I'm pretty new to embedded development.

The link you posted contains the hex file. Do you have the source files available? Thanks!

Hello @woozl​ ,

Try to increase the stack size from 0x400 to 0x800 in the icf/ld file.

Please let me know if this solves your problem.

BeST Regards,

Walid

Yes, it tends to save support costs on getting the compiler/tools working, and reducing the number of reasons why it doesn't work in any given scenario.

Figure most of the things I work on tend to have already involved many man-days of work/analysis.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I'm having the same issue @woozl​ . I've set the stack size on both cores to 0x800 and have the same error. Through the debugger, I've traced the issue back to line 948 of the stm32h7xx_hal_mmc.c file. The error code for the hmmc struct is "HAL_MMC_ERROR_TX_UNDERRUN". Anywhere to look for info on that?

POLLED mode is failed..

Try reducing clocking speed, or bandwidth via 4-bit mode

There might be dumber code deeper in the driver that auto-senses and picks it's own numbers. Could perhaps drop the PLL clock the unit is using..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
/**
  * @brief  Initializes the SDMMC1 peripheral.
  * @param  hmmc SD handle
  * @retval HAL status
  */
__weak HAL_StatusTypeDef MX_MMC_SD_Init(MMC_HandleTypeDef *hmmc)
{
  HAL_StatusTypeDef ret = HAL_OK;
 
  hmmc->Instance                 = SDMMC1;
  hmmc->Init.ClockDiv            = 2; // << MAKE MORE BIGGER
  hmmc->Init.ClockPowerSave      = SDMMC_CLOCK_POWER_SAVE_DISABLE;
  hmmc->Init.ClockEdge           = SDMMC_CLOCK_EDGE_RISING;
  hmmc->Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
  hmmc->Init.BusWide             = SDMMC_BUS_WIDE_8B; // << MAKE LESS WIDE
 
  /* HAL SD initialization */
  if(HAL_MMC_Init(hmmc) != HAL_OK)
  {
    ret = HAL_ERROR;
  }
 
  return ret;
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Reducing speed and bandwidth did the trick -- the example works now. Your help is much appreciated!