{
return MSD_ERROR;
}
+
+ // Reset defaults. High-speed mode can be incorrectly set if user removed then
+ // inserted a new SD card and we re-run initialisation.
+ hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
+ hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
+
SD_state = HAL_SD_Init(&hsd);
#ifdef BUS_4BITS
if (SD_state == HAL_OK)
// power on\r
if (!firstInit)\r
{\r
- for (int i = 0; cs && i < 50; ++i)\r
+ for (int i = 0; cs && (i < 50); ++i)\r
{\r
cs = HAL_GPIO_ReadPin(nSD_CD_GPIO_Port, nSD_CD_Pin) ? 0 : 1;\r
s2s_delay_ms(5);\r