I don't understand how to read the extcsd register

911(C)
Posts: 2
Joined: Wed Dec 16, 2020 8:52 am

I don't understand how to read the extcsd register

Postby 911(C) » Fri Dec 25, 2020 11:27 pm

I connected emmc chip to esp32 and initialized host. The host mounted the card and populated the sdmmc_card_t structure. In the structure, the sdmmc_ext_csd_t ext_csd field does not fully read the register. Tell me how to fully read the extcsd register and display it or write it to a separate file?

Code: Select all

typedef struct {
sdmmc_host_t host;
uint32_t ocr;
sdmmc_cid_t cid;
sdmmc_csd_t csd;
sdmmc_scr_t scr;
sdmmc_ext_csd_t ext_csd;   <<<
uint16_t rca;
uint16_t max_freq_khz;
uint32_t is_mem : 1;
uint32_t is_sdio : 1;
uint32_t is_mmc : 1;
uint32_t num_io_functions : 3;
uint32_t log_bus_width : 2;
uint32_t is_ddr : 1;
uint32_t reserved : 23;
} sdmmc_card_t;

Code: Select all

typedef struct {
uint8_t power_class;   <<<
} sdmmc_ext_csd_t;
I am trying to send a command to the card but the data does not come and the transfer ends ESP_ERR_TIMEOUT.

Code: Select all

uint8_t ecsd[EXT_CSD_MMC_SIZE] = {};

sdmmc_command_t cmd;
cmd.opcode = MMC_SEND_EXT_CSD;
cmd.arg = 0;
cmd.response[0] = 0;
cmd.response[1] = 0;
cmd.response[2] = 0;
cmd.response[3] = 0;
cmd.data = &ecsd;
cmd.datalen = 0;
cmd.blklen = 1;
cmd.flags = SCF_RSP_R1 | SCF_CMD_ADTC;
cmd.error = 0;
cmd.timeout_ms = 100;

Serial.println("sdmmc_host_do_transaction");
lerr = host.do_transaction(SDMMC_HOST_SLOT_1, &cmd);
Serial.println(esp_err_to_name(lerr));

Serial.println("sdmmc_command_t error field");
Serial.println(esp_err_to_name(cmd.error));
Although the function itself returns zero, the data is not written to the array. Maybe I'm not using the command structure. I do not understand what the flag field means ... can anyone tell me what it means? There is not a word in the official documentation.

Code: Select all

cmd.flags = ???

Who is online

Users browsing this forum: cdollar and 71 guests