The use of Kendryte K210 SD card on freertos

First modify the project_cfg.h file to define the hardware-defined i2c pins as follows:

const fpioa_cfg_t g_fpioa_cfg =
{
    .version = PIN_CFG_VERSION,
    .functions_count = 4,
    .functions =
    {
        {32, FUNC_GPIOHS0 + TF_CS_GPIONUM},
        {29, FUNC_SPI0_SCLK},
        {30, FUNC_SPI0_D0},
        {31, FUNC_SPI0_D1},
    }
};

Then in the main function is as follows:

handle_t install_sdcard()
{
    handle_t spi, gpio;
    configASSERT(spi = io_open("/dev/spi0"));
    configASSERT(gpio = io_open("/dev/gpio0"));
    handle_t sd0 = spi_sdcard_driver_install(spi, gpio, 7);
    io_close(spi);
    io_close(gpio);
    return sd0;
}
    printf("Hello sd\n");
    char msg[]="k233333333333333333";
    char buffer[32];
    handle_t sd0 = install_sdcard();
    configASSERT(sd0);
    configASSERT(filesystem_mount("/fs/0/&

Guess you like

Origin blog.csdn.net/smile_5me/article/details/106836847