2015-11-21 09:40 AM
2015-11-21 11:07 AM
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.2015-11-22 11:53 PM
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) = 96HCLK(MHZ) = 96APB1 Peripheral clock (MHZ) = 24APB2 peripheral clock (MHZ) = 48Nothing 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 isdisk_initialize
and it seems that initialization succeeded as I get no error after this call.The error comes when I callfmt = 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 */