2023-09-23 10:47 AM
I'm following the example the USB MSC Standalone example provided here:
https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Projects/STM32446E_EVAL/Applications/USB_Device/MSC_Standalone/Src/usbd_storage.c
I am attempting to get the eMMC that is connected to my STM32F466RE to be detected as a Mass Storage device on the PC.
int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 6 */
uint32_t timeout = 100000;
HAL_StatusTypeDef status = HAL_MMC_ReadBlocks_DMA(&hmmc, buf, blk_addr, blk_len);
/* Wait for Rx Transfer completion */
while (readstatus == 0){} // <- STUCK HERE
readstatus = 0;
while(HAL_MMC_GetCardState(&hmmc) != HAL_MMC_CARD_TRANSFER)
{
if (timeout-- == 0)
{
return (USBD_FAIL);
}
}
return (USBD_OK);
/* USER CODE END 6 */
}
/**
* @brief BSP Rx Transfer completed callbacks
* @PAram None
* @retval None
*/
void HAL_MMC_RxCpltCallback(MMC_HandleTypeDef *hmmc)
{
readstatus = 1;
}
2023-09-23 10:58 AM
Hello @LDAP7907
I advice you to debug your code step by step your code to localise the issue.
Best regards.
II