cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 + USB-FS + SDIO , USB transfer complete

abhishek kr
Associate II
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
1 REPLY 1

Sorry, bumping old zombie unanswered threads off my feed

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