![]() ![]() STORAGE_GetCapacity_FS() should return the block size and the number of blocks, and now we can calculate it. ![]() So, they should be defined in usbd_storage_if.c file too: extern SD_HandleTypeDef hsd Įxtern HAL_SD_CardInfoTypedef SDCardInfo This function takes two arguments which are defined in the main.c file. To get SD-card full size we can use HAL_SD_Get_CardInfo(). Secondly, STORAGE_GetCapacity_FS() function has to be modified. ![]() Let's edit some of them in order to make our device working! Firstly, we should correct the block size: #define BLOCK_SIZE 512 STMCubeMx doesn't fill this functions, so they are empty. Thus, we should edit usbd_storage_if.c file, where all the functions needed for USB interface are located: STORAGE_Init_FS, HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_RESET) Īs you see, Cube has already initialised SDIO and USB, but it doesn't take care about relations between these units. Firstly, I'll reset the output state of USB_DISCONNECT_PIN: /* Initialize all configured peripherals */ When the generation is finished, the project is ready for programming the MCU, but we have to make some modifications in the source files. In principle, after that all units are configured properly, so we can start the project generation process!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |