cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in FreeRTOS+cubef4+usb host

askari.nima
Associate II
Posted on July 02, 2014 at 16:55

I choose USB host MSC + FREERTOS+FATFS .

make a project and compile it .

but when i connect a USB flash , it dose not  work.

but when I don't choose FreeRTOS , It worked.

why ?

#usb-msc-mass-storage #stm32f4-discovery #fatfs
4 REPLIES 4
Posted on July 04, 2014 at 14:23

Hiaskari.nima,

Please ensure that your project stack value is set up properly, try to increase it. Otherwise ensure that the Systick_Handler is as it follows:

/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
if (xTaskGetSchedulerState()!=taskSCHEDULER_NOT_STARTED)
{
xPortSysTickHandler();
}
HAL_IncTick();
}

Meanwhile can you provide us your STM32CubeMX Project .ioc file ? With regards.
imed
Associate II
Posted on July 04, 2014 at 15:43

Please ensure that the USBH_LL_DriverVBUS in the usbh_conf.c is not empty.

For STM324xG_EVAL platform use this:

USBH_StatusTypeDef  USBH_LL_DriverVBUS (USBH_HandleTypeDef *phost, uint8_t state)

{

  if(state == 0)

  {

    HAL_GPIO_WritePin(GPIOH, GPIO_PIN_5, GPIO_PIN_SET);

  }

  else

  {

    HAL_GPIO_WritePin(GPIOH, GPIO_PIN_5, GPIO_PIN_RESET);

  }

 

  HAL_Delay(200);

  return USBH_OK;

}

And configure your IO Pin in MspInit:

     GPIO_InitStruct.Pin = GPIO_PIN_5;

    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

gafsos

askari.nima
Associate II
Posted on July 05, 2014 at 10:28

i have 5 v in usb flash disk .

my project file is here

my board is stm32f4discovery

________________

Attachments :

sdf.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzRJ&d=%2Fa%2F0X0000000bMd%2FUIMI1uYmVihIApbad476NipZNcOAU.V842sS38Bncoc&asPdf=false
alegasalv2
Associate
Posted on August 20, 2014 at 18:53

Hi, I was wondering if you could resolve that problem?

I have the exact same situation, I'm using the STM32F4-Discovery Board, and the STM32CubeMX program for configurating the device. I want to make the same configuration as the example, that is Host USB - MSC - FATFs, but with the FreeRTOS. But I'm having problems when it wants to open a file. It keeps me giving error. I've configured the USBH_LL_DriverVBUSas it says in the usbh_conf.cfile in the example application.

USBH_StatusTypeDef USBH_LL_DriverVBUS(USBH_HandleTypeDef *phost, uint8_t state)
{
if(state == 0)
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
}
HAL_Delay(200);
return USBH_OK; 
}

FreeRTOS configuration:
  • MINIMAL_STACK_SIZE 512
  • TOTAL_HEAP_SIZE 15360
  • Memory Managment scheme heap_4