cancel
Showing results for 
Search instead for 
Did you mean: 

A lot of busy waiting in STM32F4 HAL USB libraries? Not RTOS friendly?

bernieserver
Associate II

I want to implement an USB host MSC class for concurrent log transfer to an USB stick inside an RTOS context. I have seen the newest USB host device librarie implements an RTOS / CMSIS interface. But I have seen in code that there are still a lot of busy waitings. For example: In function

USBH_MSC_Write

in usbh_msc.c

there is the following wile loop:

  while (USBH_MSC_RdWrProcess(phost, lun) == USBH_BUSY)
  {
    if(((phost->Timer - timeout) >  (10000U * length)) || (phost->device.is_connected == 0U))
    {
      MSC_Handle->state = MSC_IDLE;
      return USBH_FAIL;
    }
  }

Inside this loop in the function

static USBH_StatusTypeDef USBH_MSC_RdWrProcess(USBH_HandleTypeDef *phost, uint8_t lun)

there is a state machine which checks some inner states.

Does this while Loop blocks the whole CPU during transfer preventing lower priorized task to run?

Thanks and kindly regards

Bernhard.

This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0