Commit 823a961e authored by Dave Hylands's avatar Dave Hylands Committed by Damien George
Browse files

stmhal: Enable sdcard on STM32F7DISC board.

parent 3510499a
......@@ -4,7 +4,7 @@
#define MICROPY_HW_MCU_NAME "STM32F746"
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_HAS_SDCARD (0)
#define MICROPY_HW_HAS_SDCARD (1)
#define MICROPY_HW_HAS_MMA7660 (0)
#define MICROPY_HW_HAS_LIS3DSH (0)
#define MICROPY_HW_HAS_LCD (0)
......@@ -78,6 +78,11 @@ void STM32F7DISC_board_early_init(void);
#define MICROPY_HW_LED_ON(pin) (pin->gpio->BSRR = pin->pin_mask)
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->BSRR = (pin->pin_mask << 16))
// SD card detect switch
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_C13)
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
// USB config (CN13 - USB OTG FS)
// The Hardware VBUS detect only works on pin PA9. The STM32F7 Discovery uses
// PA9 for VCP_TX functionality and connects the VBUS to pin J12 (so software
......
......@@ -37,6 +37,34 @@
#if MICROPY_HW_HAS_SDCARD
#if defined(MCU_SERIES_F7)
// The F7 series calls the peripheral SDMMC rather than SDIO, so provide some
// #defines for backwards compatability.
#define SDIO SDMMC1
#define SDIO_CLOCK_EDGE_RISING SDMMC_CLOCK_EDGE_RISING
#define SDIO_CLOCK_EDGE_FALLING SDMMC_CLOCK_EDGE_FALLING
#define SDIO_CLOCK_BYPASS_DISABLE SDMMC_CLOCK_BYPASS_DISABLE
#define SDIO_CLOCK_BYPASS_ENABLE SDMMC_CLOCK_BYPASS_ENABLE
#define SDIO_CLOCK_POWER_SAVE_DISABLE SDMMC_CLOCK_POWER_SAVE_DISABLE
#define SDIO_CLOCK_POWER_SAVE_ENABLE SDMMC_CLOCK_POWER_SAVE_ENABLE
#define SDIO_BUS_WIDE_1B SDMMC_BUS_WIDE_1B
#define SDIO_BUS_WIDE_4B SDMMC_BUS_WIDE_4B
#define SDIO_BUS_WIDE_8B SDMMC_BUS_WIDE_8B
#define SDIO_HARDWARE_FLOW_CONTROL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE
#define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
#define SDIO_TRANSFER_CLK_DIV SDMMC_TRANSFER_CLK_DIV
#endif
static SD_HandleTypeDef sd_handle;
void sdcard_init(void) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment