AnsweredAssumed Answered

STM32F779 USB Mass Storage and SD Card

Question asked by Hau Lam on Apr 24, 2018
Latest reply on Apr 27, 2018 by Hau Lam

I'm trying to use USB HS of STM32F779 for USB Mass Storage and SD Card.

Now I can init SDCard and can see it as USB Drive in Window. But I can not write to SDCard by function 

 

int8_t STORAGE_Write_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 14 */
if(0 != HAL_SD_WriteBlocks(&hsd1, buf, blk_addr, (uint32_t) blk_len, 10))
{
BSP_LED_On(LED1);
return USBD_FAIL;
}
/*wait until the card finish read/write*/
HAL_SD_CardStateTypeDef sd_card_state_return;
HAL_SD_StateTypeDef state_return;
uint32_t timeout = 0;
/*wait until SDMMC finish read/write*/
do
{
sd_card_state_return = HAL_SD_GetCardState(&hsd1);
timeout++;
} while((HAL_SD_CARD_TRANSFER != sd_card_state_return) && (SD_WAIT_TIMEOUT > timeout));

if((SD_WAIT_TIMEOUT <= timeout))
{
return HAL_TIMEOUT;
}
return (USBD_OK);
/* USER CODE END 14 */
}

It return error "HAL_SD_ERROR_TX_UNDERRUN" in function HAL_SD_WriteBlocks but I don't know why.

 

This is main.c

/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f7xx_hal.h"
#include "usb_device.h"
#include "stm32f769i_eval.h"
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Private variables ---------------------------------------------------------*/

SD_HandleTypeDef hsd1;

UART_HandleTypeDef huart1;

/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SDMMC1_SD_Init(void);
static void MX_USART1_UART_Init(void);

/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/

/* USER CODE END PFP */

/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
* @brief The application entry point.
*
* @retval None
*/
int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration----------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SDMMC1_SD_Init();
//MX_USART1_UART_Init();
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
BSP_LED_Off(LED1);
BSP_LED_Off(LED2);
BSP_LED_Off(LED3);
BSP_LED_Off(LED4);
while (1)
{

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */

}
/* USER CODE END 3 */

}

/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{

RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;

/**Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

/**Initializes the CPU, AHB and APB busses clocks
*/
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 = 25;
RCC_OscInitStruct.PLL.PLLN = 192;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 4;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|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;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_SDMMC1
|RCC_PERIPHCLK_CLK48;
PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLL;
PeriphClkInitStruct.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_CLK48;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

/* SDMMC1 init function */
static void MX_SDMMC1_SD_Init(void)
{

hsd1.Instance = SDMMC1;
hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hsd1.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
hsd1.Init.ClockDiv = 0;
if (HAL_SD_Init(&hsd1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

if (HAL_SD_ConfigWideBusOperation(&hsd1, SDMMC_BUS_WIDE_4B) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

}

/* USART1 init function */
static void MX_USART1_UART_Init(void)
{

huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_7B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

}

/** Configure pins
PE4 ------> FMC_A20
PE3 ------> FMC_A19
PE2 ------> ETH_TXD3
PG14 ------> ETH_TXD1
PE1 ------> FMC_NBL1
PE0 ------> FMC_NBL0
PB8 ------> I2C1_SCL
PB4 ------> SDMMC2_D3
PB3 ------> SDMMC2_D2
PD7 ------> SDMMC2_CMD
PE5 ------> FMC_A21
PE6 ------> SAI2_MCLK_B
PG13 ------> ETH_TXD0
PB9 ------> I2C1_SDA
PB7 ------> DCMI_VSYNC
PB6 ------> QUADSPI_BK1_NCS
PG15 ------> FMC_SDNCAS
PG11 ------> ETH_TX_EN
PD6 ------> SDMMC2_CK
PD0 ------> FMC_D2_DA2
PA12 ------> USB_OTG_FS_DP
PI4 ------> FMC_NBL2
PK7 ------> LTDC_DE
PK6 ------> LTDC_B7
PK5 ------> LTDC_B6
PG12 ------> SPDIFRX_IN1
PG10 ------> SDMMC2_D1
PJ14 ------> LTDC_B2
PD5 ------> FMC_NWE
PD3 ------> DCMI_D5
PD1 ------> FMC_D3_DA3
PI3 ------> FMC_D27
PI2 ------> FMC_D26
PA11 ------> USB_OTG_FS_DM
PF0 ------> FMC_A0
PI5 ------> FMC_NBL3
PI7 ------> FMC_D29
PI10 ------> FMC_D31
PI6 ------> FMC_D28
PK4 ------> LTDC_B5
PK3 ------> LTDC_B4
PG9 ------> SAI2_FS_B
PJ15 ------> LTDC_B3
PD4 ------> FMC_NOE
PH15 ------> FMC_D23
PI1 ------> FMC_D25
PF1 ------> FMC_A1
PI12 ------> LTDC_HSYNC
PI9 ------> FMC_D30
PH13 ------> FMC_D21
PH14 ------> FMC_D22
PI0 ------> FMC_D24
PA8 ------> RCC_MCO_1
PF2 ------> FMC_A2
PI13 ------> LTDC_VSYNC
PC7 ------> FMC_NE1
PF3 ------> FMC_A3
PI14 ------> LTDC_CLK
PG8 ------> FMC_SDCLK
PC6 ------> FMC_NWAIT
PF4 ------> FMC_A4
PH5 ------> FMC_SDNWE
PH3 ------> FMC_SDNE0
PG7 ------> FMC_INT
PG6 ------> FMC_NE3
PF7 ------> QUADSPI_BK1_IO2
PF6 ------> QUADSPI_BK1_IO3
PF5 ------> FMC_A5
PH2 ------> FMC_SDCKE0
PD15 ------> FMC_D1_DA1
PD10 ------> FMC_D15_DA15
PF10 ------> ADC3_IN8
PF9 ------> QUADSPI_BK1_IO1
PF8 ------> QUADSPI_BK1_IO0
PC3 ------> ETH_TX_CLK
PD14 ------> FMC_D0_DA0
PD9 ------> FMC_D14_DA14
PD8 ------> FMC_D13_DA13
PC1 ------> SAI1_SD_A
PC2 ------> ETH_TXD2
PB2 ------> QUADSPI_CLK
PF12 ------> FMC_A6
PG1 ------> FMC_A11
PF15 ------> FMC_A9
PJ4 ------> LTDC_R5
PD12 ------> FMC_A17_ALE
PD13 ------> FMC_A18
PG3 ------> FMC_A13
PG2 ------> FMC_A12
PJ5 ------> LTDC_R6
PH12 ------> FMC_D20
PA1 ------> ETH_RX_CLK
PA0/WKUP ------> SAI2_SD_B
PA4 ------> DCMI_HSYNC
PC4 ------> ETH_RXD0
PF13 ------> FMC_A7
PG0 ------> FMC_A10
PE8 ------> FMC_D5_DA5
PD11 ------> FMC_A16_CLE
PG5 ------> FMC_A15_BA1
PG4 ------> FMC_A14_BA0
PH7 ------> ETH_RXD3
PH9 ------> FMC_D17
PH11 ------> FMC_D19
PA2 ------> SAI2_SCK_B
PA6 ------> DCMI_PIXCLK
PC5 ------> ETH_RXD1
PF14 ------> FMC_A8
PJ2 ------> DSIHOST_TE
PF11 ------> FMC_SDNRAS
PE9 ------> FMC_D6_DA6
PE11 ------> FMC_D8_DA8
PE14 ------> FMC_D11_DA11
PH6 ------> ETH_RXD2
PH8 ------> FMC_D16
PH10 ------> FMC_D18
PA7 ------> ETH_RX_DV
PE7 ------> FMC_D4_DA4
PE10 ------> FMC_D7_DA7
PE12 ------> FMC_D9_DA9
PE15 ------> FMC_D12_DA12
PE13 ------> FMC_D10_DA10
*/
static void MX_GPIO_Init(void)
{

GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOJ_CLK_ENABLE();
__HAL_RCC_GPIOI_CLK_ENABLE();
__HAL_RCC_GPIOK_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOJ, MII_MDC_GPIO_Pin|MII_MDIO_GPIO_Pin|LED3_Pin|LED1_Pin
|LED2_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);

/*Configure GPIO pins : A20_Pin A19_Pin FMC_NBL1_Pin FMC_NBL0_Pin
A21_Pin D5_Pin D6_Pin D8_Pin
D11_Pin D4_Pin D7_Pin D9_Pin
D12_Pin D10_Pin */
GPIO_InitStruct.Pin = A20_Pin|A19_Pin|FMC_NBL1_Pin|FMC_NBL0_Pin
|A21_Pin|D5_Pin|D6_Pin|D8_Pin
|D11_Pin|D4_Pin|D7_Pin|D9_Pin
|D12_Pin|D10_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

/*Configure GPIO pin : MII_TXD3_Pin */
GPIO_InitStruct.Pin = MII_TXD3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(MII_TXD3_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : MII_TXD1_Pin MII_TXD0_Pin MII_TX_EN_Pin */
GPIO_InitStruct.Pin = MII_TXD1_Pin|MII_TXD0_Pin|MII_TX_EN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

/*Configure GPIO pins : I2C1_SCL_Pin I2C1_SDA_Pin */
GPIO_InitStruct.Pin = I2C1_SCL_Pin|I2C1_SDA_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/*Configure GPIO pins : SD2_D3_Pin SD2_D2_Pin */
GPIO_InitStruct.Pin = SD2_D3_Pin|SD2_D2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_SDMMC2;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/*Configure GPIO pins : SD2_CMD_Pin SD2_CLK_Pin */
GPIO_InitStruct.Pin = SD2_CMD_Pin|SD2_CLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

/*Configure GPIO pin : SAI2_MCLKB_Pin */
GPIO_InitStruct.Pin = SAI2_MCLKB_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF10_SAI2;
HAL_GPIO_Init(SAI2_MCLKB_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : PAR_VSYNC_Pin */
GPIO_InitStruct.Pin = PAR_VSYNC_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
HAL_GPIO_Init(PAR_VSYNC_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : QSPI_BK1_NCS_Pin */
GPIO_InitStruct.Pin = QSPI_BK1_NCS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
HAL_GPIO_Init(QSPI_BK1_NCS_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : SDNCAS_Pin SDCLK_Pin NAND_INT_Pin FMC_NE3_Pin
A11_Pin A13_Pin A12_Pin A10_Pin
A15_Pin A14_Pin */
GPIO_InitStruct.Pin = SDNCAS_Pin|SDCLK_Pin|NAND_INT_Pin|FMC_NE3_Pin
|A11_Pin|A13_Pin|A12_Pin|A10_Pin
|A15_Pin|A14_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

/*Configure GPIO pins : MII_MDC_GPIO_Pin MII_MDIO_GPIO_Pin LED3_Pin LED1_Pin
LED2_Pin */
GPIO_InitStruct.Pin = MII_MDC_GPIO_Pin|MII_MDIO_GPIO_Pin|LED3_Pin|LED1_Pin
|LED2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);

/*Configure GPIO pins : D2_Pin FMC_NWE_Pin D3_Pin FMC_NOE_Pin
D1_Pin D15_Pin D0_Pin D14_Pin
D13_Pin A17_Pin A18_Pin A16_Pin */
GPIO_InitStruct.Pin = D2_Pin|FMC_NWE_Pin|D3_Pin|FMC_NOE_Pin
|D1_Pin|D15_Pin|D0_Pin|D14_Pin
|D13_Pin|A17_Pin|A18_Pin|A16_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

/*Configure GPIO pins : USB_FS1_DP_Pin USB_FS1_DM_Pin */
GPIO_InitStruct.Pin = USB_FS1_DP_Pin|USB_FS1_DM_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pin : EXPANDER_INT_Pin */
GPIO_InitStruct.Pin = EXPANDER_INT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(EXPANDER_INT_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : FMC_NBL2_Pin D27_Pin D26_Pin FMC_NBL3_Pin
D29_Pin D31_Pin D28_Pin D25_Pin
D30_Pin D24_Pin */
GPIO_InitStruct.Pin = FMC_NBL2_Pin|D27_Pin|D26_Pin|FMC_NBL3_Pin
|D29_Pin|D31_Pin|D28_Pin|D25_Pin
|D30_Pin|D24_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);

/*Configure GPIO pins : LCD_DE_Pin LCD_B7_Pin LCD_B6_Pin LCD_B5_Pin
LCD_B4_Pin */
GPIO_InitStruct.Pin = LCD_DE_Pin|LCD_B7_Pin|LCD_B6_Pin|LCD_B5_Pin
|LCD_B4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
HAL_GPIO_Init(GPIOK, &GPIO_InitStruct);

/*Configure GPIO pin : SPDIF_RX1_Pin */
GPIO_InitStruct.Pin = SPDIF_RX1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_SPDIFRX;
HAL_GPIO_Init(SPDIF_RX1_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : SD2_D1_Pin */
GPIO_InitStruct.Pin = SD2_D1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_SDMMC2;
HAL_GPIO_Init(SD2_D1_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : LCD_B2_Pin LCD_B3_Pin LCD_R5_Pin LCD_R6_Pin */
GPIO_InitStruct.Pin = LCD_B2_Pin|LCD_B3_Pin|LCD_R5_Pin|LCD_R6_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);

/*Configure GPIO pin : PAR_D5_Pin */
GPIO_InitStruct.Pin = PAR_D5_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
HAL_GPIO_Init(PAR_D5_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : TAMPER_WKUP_KEY_Pin */
GPIO_InitStruct.Pin = TAMPER_WKUP_KEY_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(TAMPER_WKUP_KEY_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : A0_Pin A1_Pin A2_Pin A3_Pin
A4_Pin A5_Pin A6_Pin A9_Pin
A7_Pin A8_Pin SDNRAS_Pin */
GPIO_InitStruct.Pin = A0_Pin|A1_Pin|A2_Pin|A3_Pin
|A4_Pin|A5_Pin|A6_Pin|A9_Pin
|A7_Pin|A8_Pin|SDNRAS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

/*Configure GPIO pin : SAI2_FSB_Pin */
GPIO_InitStruct.Pin = SAI2_FSB_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF10_SAI2;
HAL_GPIO_Init(SAI2_FSB_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : D23_Pin D21_Pin D22_Pin SDNWE_Pin
SDNE0_Pin SDCKE0_Pin D20_Pin D17_Pin
D19_Pin D16_Pin D18_Pin */
GPIO_InitStruct.Pin = D23_Pin|D21_Pin|D22_Pin|SDNWE_Pin
|SDNE0_Pin|SDCKE0_Pin|D20_Pin|D17_Pin
|D19_Pin|D16_Pin|D18_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

/*Configure GPIO pins : LCD_HSYNC_Pin LCD_VSYNC_Pin LCD_CLK_Pin */
GPIO_InitStruct.Pin = LCD_HSYNC_Pin|LCD_VSYNC_Pin|LCD_CLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);

/*Configure GPIO pin : MII_MCO_Pin */
GPIO_InitStruct.Pin = MII_MCO_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(MII_MCO_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : LED0_Pin */
GPIO_InitStruct.Pin = LED0_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED0_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : FMC_NE1_Pin FMC_NWAIT_Pin */
GPIO_InitStruct.Pin = FMC_NE1_Pin|FMC_NWAIT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF9_FMC;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

/*Configure GPIO pins : QSPI_BK1_IO2_Pin QSPI_BK1_IO3_Pin */
GPIO_InitStruct.Pin = QSPI_BK1_IO2_Pin|QSPI_BK1_IO3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

/*Configure GPIO pin : Potentiometer_Pin */
GPIO_InitStruct.Pin = Potentiometer_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(Potentiometer_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : QSPI_BK1_IO1_Pin QSPI_BK1_IO0_Pin */
GPIO_InitStruct.Pin = QSPI_BK1_IO1_Pin|QSPI_BK1_IO0_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

/*Configure GPIO pins : MII_TX_CLK_Pin MII_TXD2_Pin MII_RXD0_Pin MII_RXD1_Pin */
GPIO_InitStruct.Pin = MII_TX_CLK_Pin|MII_TXD2_Pin|MII_RXD0_Pin|MII_RXD1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

/*Configure GPIO pin : SAI1_SDA_Pin */
GPIO_InitStruct.Pin = SAI1_SDA_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF6_SAI1;
HAL_GPIO_Init(SAI1_SDA_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : QSPI_CLK_Pin */
GPIO_InitStruct.Pin = QSPI_CLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
HAL_GPIO_Init(QSPI_CLK_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : MII_RX_CLK_Pin MII_RX_DV_Pin */
GPIO_InitStruct.Pin = MII_RX_CLK_Pin|MII_RX_DV_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pin : SAI2_SDB_Pin */
GPIO_InitStruct.Pin = SAI2_SDB_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF10_SAI2;
HAL_GPIO_Init(SAI2_SDB_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : PAR_HSYNC_Pin PAR_PCLK_Pin */
GPIO_InitStruct.Pin = PAR_HSYNC_Pin|PAR_PCLK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pins : MII_RXD3_Pin MII_RXD2_Pin */
GPIO_InitStruct.Pin = MII_RXD3_Pin|MII_RXD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

/*Configure GPIO pin : SAI2_SCKB_Pin */
GPIO_InitStruct.Pin = SAI2_SCKB_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF8_SAI2;
HAL_GPIO_Init(SAI2_SCKB_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : DSI_TE_Pin */
GPIO_InitStruct.Pin = DSI_TE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF13_DSI;
HAL_GPIO_Init(DSI_TE_GPIO_Port, &GPIO_InitStruct);

}

/* USER CODE BEGIN 4 */

/* USER CODE END 4 */

/**
* @brief This function is executed in case of error occurrence.
* @param file: The file name as string.
* @param line: The line in file as a number.
* @retval None
*/
void _Error_Handler(char *file, int line)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
/* USER CODE END Error_Handler_Debug */
}

#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

/**
* @}
*/

/**
* @}
*/

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

 

and this is usbd_storage_if.c

/* Includes ------------------------------------------------------------------*/
#include "usbd_storage_if.h"
#include "stm32f769i_eval.h"

/* USER CODE BEGIN INCLUDE */

/* USER CODE END INCLUDE */

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/

/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/

/* USER CODE END PV */

/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
* @brief Usb device.
* @{
*/

/** @defgroup USBD_STORAGE
* @brief Usb mass storage device module
* @{
*/

/** @defgroup USBD_STORAGE_Private_TypesDefinitions
* @brief Private types.
* @{
*/

/* USER CODE BEGIN PRIVATE_TYPES */

/* USER CODE END PRIVATE_TYPES */

/**
* @}
*/

/** @defgroup USBD_STORAGE_Private_Defines
* @brief Private defines.
* @{
*/

#define STORAGE_LUN_NBR 1
#define STORAGE_BLK_NBR 0x10000
#define STORAGE_BLK_SIZ 0x200
#define SD_WAIT_TIMEOUT 10
/* USER CODE BEGIN PRIVATE_DEFINES */

/* USER CODE END PRIVATE_DEFINES */

/**
* @}
*/

/** @defgroup USBD_STORAGE_Private_Macros
* @brief Private macros.
* @{
*/

/* USER CODE BEGIN PRIVATE_MACRO */

/* USER CODE END PRIVATE_MACRO */

/**
* @}
*/

/** @defgroup USBD_STORAGE_Private_Variables
* @brief Private variables.
* @{
*/

/* USER CODE BEGIN INQUIRY_DATA_HS */
/** USB Mass storage Standard Inquiry Data. */
const int8_t STORAGE_Inquirydata_HS[] = {/* 36 */

/* LUN 0 */
0x00,
0x80,
0x02,
0x02,
(STANDARD_INQUIRY_DATA_LEN - 5),
0x00,
0x00,
0x00,
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0' ,'1' /* Version : 4 Bytes */
};
/* USER CODE END INQUIRY_DATA_HS */

/* USER CODE BEGIN PRIVATE_VARIABLES */

/* USER CODE END PRIVATE_VARIABLES */

/**
* @}
*/

/** @defgroup USBD_STORAGE_Exported_Variables
* @brief Public variables.
* @{
*/

extern USBD_HandleTypeDef hUsbDeviceHS;
extern SD_HandleTypeDef hsd1;
HAL_SD_CardInfoTypeDef SDCardInfo;

/* USER CODE BEGIN EXPORTED_VARIABLES */

/* USER CODE END EXPORTED_VARIABLES */

/**
* @}
*/

/** @defgroup USBD_STORAGE_Private_FunctionPrototypes
* @brief Private functions declaration.
* @{
*/

static int8_t STORAGE_Init_HS(uint8_t lun);
static int8_t STORAGE_GetCapacity_HS(uint8_t lun, uint32_t *block_num, uint16_t *block_size);
static int8_t STORAGE_IsReady_HS(uint8_t lun);
static int8_t STORAGE_IsWriteProtected_HS(uint8_t lun);
static int8_t STORAGE_Read_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
static int8_t STORAGE_Write_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
static int8_t STORAGE_GetMaxLun_HS(void);

/* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */
/* SDMMC1 init function */
static void MX_SDMMC1_SD_Init(void)
{

hsd1.Instance = SDMMC1;
hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hsd1.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
hsd1.Init.ClockDiv = 0;
if (HAL_SD_Init(&hsd1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

if (HAL_SD_ConfigWideBusOperation(&hsd1, SDMMC_BUS_WIDE_4B) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

}
/* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */

/**
* @}
*/

USBD_StorageTypeDef USBD_Storage_Interface_fops_HS =
{
STORAGE_Init_HS,
STORAGE_GetCapacity_HS,
STORAGE_IsReady_HS,
STORAGE_IsWriteProtected_HS,
STORAGE_Read_HS,
STORAGE_Write_HS,
STORAGE_GetMaxLun_HS,
(int8_t *)STORAGE_Inquirydata_HS
};

/* Private functions ---------------------------------------------------------*/

/**
* @brief .
* @param lun: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_Init_HS(uint8_t lun)
{
/* USER CODE BEGIN 9 */
return (USBD_OK);
/* USER CODE END 9 */
}

/**
* @brief .
* @param lun: .
* @param block_num: .
* @param block_size: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_GetCapacity_HS(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
{
/* USER CODE BEGIN 10 */
HAL_SD_GetCardInfo(&hsd1, &SDCardInfo);
*block_num = SDCardInfo.BlockNbr - 1;
*block_size = SDCardInfo.BlockSize;
return (USBD_OK);
/* USER CODE END 10 */
}

/**
* @brief .
* @param lun: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_IsReady_HS(uint8_t lun)
{
/* USER CODE BEGIN 11 */
return (USBD_OK);
/* USER CODE END 11 */
}

/**
* @brief .
* @param lun: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_IsWriteProtected_HS(uint8_t lun)
{
/* USER CODE BEGIN 12 */
return (USBD_OK);
/* USER CODE END 12 */
}

/**
* @brief .
* @param lun: .
* @param buf: .
* @param blk_addr: .
* @param blk_len: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_Read_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 13 */
if (0 != HAL_SD_ReadBlocks(&hsd1, buf, blk_addr, blk_len, 10))
{
return USBD_FAIL;
}
/*wait until the card finish read/write*/
HAL_SD_CardStateTypeDef sd_card_state_return;
HAL_SD_StateTypeDef state_return;
uint32_t timeout = 0;
do
{
sd_card_state_return = HAL_SD_GetCardState(&hsd1);
timeout++;
} while((HAL_SD_CARD_TRANSFER != sd_card_state_return) && (SD_WAIT_TIMEOUT > timeout));

if((SD_WAIT_TIMEOUT <= timeout))
{
return HAL_TIMEOUT;
}
return (USBD_OK);
/* USER CODE END 13 */
}

/**
* @brief .
* @param lun: .
* @param buf: .
* @param blk_addr: .
* @param blk_len: .
* @retval USBD_OK if all operations are OK else USBD_FAIL
*/
int8_t STORAGE_Write_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 14 */
if(0 != HAL_SD_WriteBlocks(&hsd1, buf, blk_addr, (uint32_t) blk_len, 10))
{
BSP_LED_On(LED1);
return USBD_FAIL;
}
/*wait until the card finish read/write*/
HAL_SD_CardStateTypeDef sd_card_state_return;
HAL_SD_StateTypeDef state_return;
uint32_t timeout = 0;
/*wait until SDMMC finish read/write*/
do
{
sd_card_state_return = HAL_SD_GetCardState(&hsd1);
timeout++;
} while((HAL_SD_CARD_TRANSFER != sd_card_state_return) && (SD_WAIT_TIMEOUT > timeout));

if((SD_WAIT_TIMEOUT <= timeout))
{
return HAL_TIMEOUT;
}
return (USBD_OK);
/* USER CODE END 14 */
}

/**
* @brief .
* @param None
* @retval .
*/
int8_t STORAGE_GetMaxLun_HS(void)
{
/* USER CODE BEGIN 15 */
return (STORAGE_LUN_NBR - 1);
/* USER CODE END 15 */
}

/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */

/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */

/**
* @}
*/

/**
* @}
*/

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

 

And I also attach the whole project .

Could you help me on this issue . Thank you very much.

Attachments

Outcomes