• I uploaded the fork to our repository for review/use. Right now it's set to use the TerminusT2 hardware in the makefile, but a swap to the discovery the hardware will be correct. I also made some slight adjustments in the clock usage. Now you can define the clock in the makefile, just set the divider so that it matches (8Mhz w/ 8, 16Mhz w/ 16).

    https://github.com/JanusRC/T2-Terminus/tree/master/espruinoT2

    The main adjustments that pertain to the SD card are:

    ifdef USE_FILESYSTEM_SDIO
    DEFINES += -DUSE_FILESYSTEM_SDIO
    ifeq ($(FAMILY), STM32F4)
    SOURCES += \
    libs/filesystem/fat_sd/stm32f2_4_diskio.c \
    libs/filesystem/fat_sd/stm32f2_4_sdio_sd.c
    else
    SOURCES += \
    libs/filesystem/fat_sd/sdio_diskio.c \
    libs/filesystem/fat_sd/sdio_sdcard.c
    endif 
    else 
    SOURCES += \
    libs/filesystem/fat_sd/spi_diskio.c
    endif 
    endif #!LINUX
    endif 
    

    And in the board.py file:

    'SD' : { 'pin_cmd' : 'D2',
    'pin_d0' : 'C8',
    'pin_d1' : 'C9',
    'pin_d2' : 'C10',
    'pin_d3' : 'C11',
    'pin_clk' : 'C12' },
    

    If you want to use the bitbanged SPI, you'd have to remove the SDIO defines.

    File additions that get called:
    -stm32f2_4_diskio.c
    -stm32f2_4_sdio_sd.c
    -stm32f2_4_sdio_sd.h

    As Clive1 mentioned, it'll work correctly if you boot the device up and initialize the library with the SD card in place. If you remove it and re-insert then it breaks, for now anyway.

About

Avatar for CKnight @CKnight started