SDIO slave send odd data fails in 4-bit mode

william
Posts: 1
Joined: Wed Apr 03, 2019 3:49 pm

SDIO slave send odd data fails in 4-bit mode

Postby william » Wed Apr 03, 2019 4:57 pm

Hi,

I want to use the esp32-devkit-v4 board (with esp32-wrover-b module) as SDIO slave device. And I have programmed the flash voltage selection efuses to 3.3V to make it work in 4-bit mode. I uncommented the SDIO_SLAVE_FLAG_INTERNAL_PULLUP flag and run the example code at esp-idf/examples/peripherals/sdio/salve. And the setting is 4-bit mode, 25MHz clock, 512 block size.

It works at JOB_SEND_INT, JOB_RESET and JOB_WRITE_REG. It can receicve correct data. But it's correct when it send even data such as 0xEE back to host. It's wrong with odd data such as 0x11 and the host receive [0x11 0x01 0x10 0x10 0x10 0x01 0xff 0xff ... 0xff 0xff]. The code slice is as follow:

Code: Select all

    ret = sdio_slave_send_queue(ptr, 512, NULL, portMAX_DELAY);
    if (ret == ESP_ERR_TIMEOUT) {
        // send failed, direct return the buffer to rx
        ESP_LOGE(TAG, "send_queue full.");
    }
    //ESP_ERROR_CHECK(ret);
    ESP_LOGI(TAG, "sdio_slave_send_queue finish and waiting..., ret=%d", ret);
    
    // if there's finished sending desc, return the buffer to receiving driver
    ret = sdio_slave_send_get_finished(NULL, portMAX_DELAY);
    ESP_ERROR_CHECK(ret);
I also try to make it boot to SDIO mode. It can use CMD53 command to read/write 24 bytes at 0x3ff5506c correctly.

So I think the data exchange is correct between host and slave. The problem may reside in DMA moves data from ram to SDIO device interface. What is wrong? Does it have influences that my dev board do not support SDIO interrupt?
app_main.c
(13.9 KiB) Downloaded 520 times
Best regards,
William

Who is online

Users browsing this forum: AndyCoder, Baidu [Spider], Majestic-12 [Bot] and 139 guests