Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't write or read the eMMC (IDFGH-1398) #3676

Open
khorinaj opened this issue Jun 21, 2019 · 4 comments
Open

Can't write or read the eMMC (IDFGH-1398) #3676

khorinaj opened this issue Jun 21, 2019 · 4 comments
Labels
Type: Bug bugs in IDF

Comments

@khorinaj
Copy link

I am currently using the ESP32 to read/write sectors for the eMMC devices. The circuit set up is as below.
IMG_0878
However, I can get the information from the chip, but the read/write operations are always fail with the error message E (6505) sdmmc_req: sdmmc_host_wait_for_event returned 0x107
E (6505) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x107
`#include <stdio.h>
#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_err.h"
#include "esp_log.h"
#include "esp_vfs_fat.h"
#include "driver/sdmmc_host.h"
#include "driver/sdspi_host.h"
#include "sdmmc_cmd.h"
#include "driver/gpio.h"

void setup(){
Serial.begin(112500);

sdmmc_host_init();

sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
slot_config.width = 4;

sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config);

sdmmc_host_t host = SDMMC_HOST_DEFAULT();
//host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
//host.max_freq_khz = SDMMC_FREQ_PROBING;

sdmmc_card_t card;
sdmmc_card_init(&host,&card);
Serial.println("\n ready to get information");
sdmmc_card_print_info(stdout, &card);

pinMode(15, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);

sdmmc_write_sectors(&card, data, 1000, 1);
Serial.println("check write");
ESP_ERROR_CHECK( sdmmc_write_sectors(&card, data, 1000, 1) );
sdmmc_read_sectors(&card, buff, 1000, 1);
ESP_ERROR_CHECK( sdmmc_read_sectors(&card, buff, 1000, 1) );

}

void loop() {
// put your main code here, to run repeatedly:

}`

the output is shown below
ready to get information Name: Q2J55L� Type: MMC Speed: 20 MHz Size: 7264MB CSD: ver=3, sector_size=512, capacity=14876672 read_bl_len=9 E (6505) sdmmc_req: sdmmc_host_wait_for_event returned 0x107 E (6505) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x107 check write

@github-actions github-actions bot changed the title Can't write or read the eMMC Can't write or read the eMMC (IDFGH-1398) Jun 21, 2019
@igrr
Copy link
Member

igrr commented Jun 22, 2019

Can you set log level to verbose in menuconfig, and attach the output you get?

@khorinaj
Copy link
Author

My project is Arduino based project, I don't think I can change the contents in menuconfig
WeChat233fbf467eb9da7218a7f63872db33e5
Can I simply change like this? but nothing change. The error message is the same
WeChate8de9f479bf01325bd7f6277ad60bf7f

@igrr
Copy link
Member

igrr commented Jun 22, 2019

No, indeed the log level needs to be set when compiling with the esp-idf. Since your test code is mostly independent from Arduino functionality, can you switch to IDF for the purpose of debugging this? You can also use Arduino library as IDF component: https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md
This will allow log level to be changed, revealing more information about the cause of this issue.

@khorinaj
Copy link
Author

No, indeed the log level needs to be set when compiling with the esp-idf. Since your test code is mostly independent from Arduino functionality, can you switch to IDF for the purpose of debugging this? You can also use Arduino library as IDF component: https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md
This will allow log level to be changed, revealing more information about the cause of this issue.
I just need to check one thing first. I found that in this paper https://cdn.hackaday.io/files/269911154782944/esp32_datasheet_en.pdf
It said that the SD/SDIO/MMC host controller is available on ESP32 which supports Multimedia Cards (MMC Version 4.41, eMMC Version 4.5 and Version 4.51). Is there any updated eMMC version that the ESP32 supports? Since I am using the latest version eMMC 5.0 and 5.1 for testing.

@espressif-bot espressif-bot added the Type: Bug bugs in IDF label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants