cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 USB Host MSC + FATFS f_opendir() Deadlock Issue in Bootloader

jumman_JHINGA
Senior III

Hello Everyone,

I am working on a custom USB bootloader project on STM32H743 using:

  • USB Host MSC
  • FATFS
  • External QSPI Flash
  • Internal Flash update
  • IAR Workbench
  • HAL drivers

My bootloader detects USB pendrive successfully and I can see:

  • Appli_state == APPLICATION_READY
  • f_mount() returns FR_OK

But the system gets stuck / deadlocked when calling:

DIR dir;

if(f_opendir(&dir, "0:/") != FR_OK)
{
    return UPDATE_NONE;
}

The MCU hangs inside f_opendir() and never returns.

Current flow:

MX_USB_HOST_Init();

while(1)
{
    MX_USB_HOST_Process();

    if(Appli_state == APPLICATION_READY)
    {
        HAL_Delay(500);

        update_flags = ver_check();

        break;
    }
}

Inside ver_check():

if(f_mount(&USB_FatFs, USBHPath, 0) != FR_OK)
{
    return UPDATE_NONE;
}

if(f_opendir(&dir, USBHPath) != FR_OK)
{
    return UPDATE_NONE;
}

Additional Information:

  • USB Host MSC works until f_opendir()
  • No FreeRTOS used
  • USB drive detected properly
  • f_mount() succeeds
  • Deadlock occurs specifically at f_opendir()
  • Tried both "0:/" and USBHPath
  • Tried adding delays after APPLICATION_READY

    Has anyone faced f_opendir() blocking forever on H7?

Any guidance would be greatly appreciated.

Thank you.

0 REPLIES 0