Skip to main content
geladari
Associate
November 21, 2015
Question

USB HS HOST Error

  • November 21, 2015
  • 2 replies
  • 634 views
Posted on November 21, 2015 at 18:40

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    November 21, 2015
    Posted on November 21, 2015 at 20:07

    The wait states look too low. The APB2 clock is low, the APB1 very low.

    The APB2 is 42 MHz, does that create a clock inversion compared to the USB at 48 MHz?

    Instead of focusing on the high level code you're going to have to dig into the stuff at the DISKIO.C level and below.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    geladari
    geladariAuthor
    Associate
    November 23, 2015
    Posted on November 23, 2015 at 08:53

    Thank yoy for the reply.

    I changed clock configuration to: 

     

    RCC_OscInitTypeDef RCC_OscInitStruct;

      RCC_ClkInitTypeDef RCC_ClkInitStruct;

      __PWR_CLK_ENABLE();

      __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

      RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

      RCC_OscInitStruct.HSEState = RCC_HSE_ON;

      RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

      RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

      RCC_OscInitStruct.PLL.PLLM = 4;

      RCC_OscInitStruct.PLL.PLLN = 192;

      RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;

      RCC_OscInitStruct.PLL.PLLQ = 8;

      HAL_RCC_OscConfig(&RCC_OscInitStruct);

      RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1

                                  |RCC_CLOCKTYPE_PCLK2;

      RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

      RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

      RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;

      RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

      HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);

      HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

      HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

      /* SysTick_IRQn interrupt configuration */

      HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

    This configuration according STM32CubeMX gives 

    SYSCLK(MHZ) = 96

    HCLK(MHZ) = 96

    APB1 Peripheral clock (MHZ) = 24

    APB2 peripheral clock (MHZ) = 48

    Nothing changed in the functionality.

    I have exactly the same error.

    Maybe I should also mention that the LED of my USB Flash memory is never switched on.

    >> Instead of focusing on the high level code you're going to have to dig into the stuff at the DISKIO.C level and below.

    The only function of diskio.c which is called before I get the error is 

    disk_initialize

    and it seems that initialization succeeded as I get no error after this call.

    The error comes when I call

    fmt = check_fs(fs, bsect); /* Load sector 0 and check if it is an FAT boot sector as SFD */

    this call give me the error.

    if (fmt == 3) return FR_DISK_ERR;

    /* An error occured in the disk I/O layer */