STM32f407VG SD card and USB Mass Storage using stmcubemx version 4.21.0
Hi Guys,
I want to see the content of my SD card in pc using USB mass storage. I implement my project using stmcubemx version 4.21.0. The SD card works meaning that I can create a .txt file and write something into it. When I put the SD card into adapter and connect to PC, I can also see its contents, as expected.
However, i can not see its contents using USB mass storage! In usbd_storage_if.c file, there is a STORAGE_READ_FS function to read SD card contents using USB. SInce it is originally empty, I modify it as follows:
int8_t STORAGE_Read_FS (uint8_t lun,
uint8_t *buf,
uint32_t blk_addr,
uint16_t blk_len)
{
/* USER CODE BEGIN 6 */
HAL_SD_ReadBlocks(&hsd, buf, blk_addr, blk_len, 10);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_SET); //Orange LED);
return (USBD_OK);
However, it doesn't work! Moreover, I cannot watch buf, blk_addr, blk_len in live watch to see what such arguments contain!
It really blocks me for a while! Do you guys face such issue? or have any suggestions ?
Infinite thanks in advance!
Cheers
Edmond