From 1844e46167967eee7e3069dfbefe56f3b6cd6ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Tue, 27 Sep 2016 17:41:53 +0200 Subject: [PATCH] fixed clock switch --- FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }