diff --git a/FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c b/FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c index 6107854..9b147e0 100644 --- a/FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c +++ b/FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c @@ -214,12 +214,11 @@ void initModuleHw(){ } void switchPrescaler(uint8_t clkdiv) { - SDIO->POWER = 0; - __DSB(); - SDIO->CLKCR &= ~SDIO_CLKCR_CLKDIV; // Clear prescaler - SDIO->CLKCR |= (SDIO_CLKCR_CLKDIV & clkdiv); // Set bits - __DSB(); - SDIO->POWER = SDIO_POWER_PWRCTRL_0 | SDIO_POWER_PWRCTRL_1; + uint32_t reg; + reg = SDIO->CLKCR; + reg &= ~SDIO_CLKCR_CLKDIV; // Clear prescaler + reg |= (SDIO_CLKCR_CLKDIV & clkdiv); // Set bits + SDIO->CLKCR = reg; }