The better way to solve this for me wasn't changing the generated code but solving a bug (IMO it's a bug or bad implementation).From SD_InitCard() remove (void)SDIO_Init(hsd->Instance, hsd->Init);Because that initialization is made with the final sp...