Skip to main content
abhishek kr
Associate II
April 23, 2018
Question

STM32F4 + USB-FS + SDIO , USB transfer complete

  • April 23, 2018
  • 1 reply
  • 633 views
Posted on April 23, 2018 at 05:58

I am using STM32F4 to make a usb msc device using USB-FS and SDIO. EVerything is working great. I am not able to detect the USB transfer complete interrupt. Any clue about it.

I am using the most updated version of cubemx and stm firmware. Please find the Cube generated ioc file attached.

usbd_storage_if.c:

These are the modified functions:

int8_t STORAGE_GetCapacity_FS (uint8_t lun, uint32_t *block_num, uint16_t *block_size){

HAL_SD_CardInfoTypeDef info;

HAL_SD_GetCardInfo(&hsd,&info);

*block_num =info.LogBlockNbr - 1;

*block_size = info.LogBlockSize;

return (USBD_OK);

/* USER CODE END 3 */

}

int8_t STORAGE_Read_FS (uint8_t lun, uint8_t *buf, uint32_t blk_addr,uint16_t blk_len){

   if(BSP_SD_ReadBlocks((uint32_t *)buf,blk_addr,blk_len,SDMMC_DATATIMEOUT)!=MSD_OK){

   return (USBD_FAIL);

   }

   while (BSP_SD_GetCardState() !=

SD_TRANSFER_OK

);

   return (USBD_OK);

/* USER CODE END 6 */

}

int8_t STORAGE_Write_FS (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len){

   if(BSP_SD_WriteBlocks((uint32_t *)buf,blk_addr,blk_len,SDMMC_DATATIMEOUT)!=MSD_OK){

   return (USBD_FAIL);

   }

while (BSP_SD_GetCardState() != SD_TRANSFER_OK){}

return (USBD_OK);

/* USER CODE END 7 */

}

#stm32f4-+-usb-+sdio
This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
August 10, 2018

Sorry, bumping old zombie unanswered threads off my feed

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..