How to use test_sd.c

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Wed Aug 16, 2017 1:12 pm

Maybe you can run some other example (which runs) on the same hardware and compare bootloader log (up to 'entry' line) to see if there is any difference in SPI flash parameters?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: How to use test_sd.c

Postby WiFive » Wed Aug 16, 2017 4:35 pm

Did you try 'make erase_flash'?

It looks like you may have an otadata partition which selects ota_0

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Wed Aug 16, 2017 5:11 pm

SDMMC test
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:4124
load:0x40078000,len:0
load:0x40078000,len:11968
entry 0x40078cd8


Blink example
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5108
load:0x40078000,len:0
load:0x40078000,len:12652
entry 0x40078f44

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Sat Aug 19, 2017 4:47 pm

WiFive wrote:Did you try 'make erase_flash'?

It looks like you may have an otadata partition which selects ota_0
Sorry, i haven't read your post. And yes, that was the right clue.

I tried again

Code: Select all

make flash monitor TEST_COMPONENTS=sdmmc ESPPORT=/dev/ttyUSB0
Now i get "Here's the test menu, pick your combo:". But there is nothing, i can only press enter at this point and i'll get
"0 Tests 0 Failures 0 Ignored
OK
Here's the test menu, pick your combo:"

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Thu Aug 24, 2017 11:53 am

Ok, tried this on my second computer. Weird, it's working there (esp idf versions are the same):

Code: Select all

Here's the test menu, pick your combo:
(1)     "can probe SD" [sd][ignore]
(2)     "can probe SD (using SPI)" [sdspi][ignore]
(3)     "can write and read back blocks" [sd][ignore]
(4)     "can write and read back blocks (using SPI)" [sdspi][ignore]
(5)     "reads and writes with an unaligned buffer" [sd][ignore]
But now i can't select of one those combos with a number. Basically, i can't enter any number/text

Edit: Ah, well, it seems that mingW doesn't view my inputs. For example, when i just type * and press Enter, the test is running.
:can probe SD:FAIL: Expected 0 Was 259
Test ran in 11ms
can write and read back blocks:FAIL: Expected 0 Was 2
59
Test ran in 14ms
can write and read back blocks (using SPI):FAIL: Expe
cted 0 Was 259
Test ran in 23ms
reads and writes with an unaligned buffer:FAIL: Expec
ted 0 Was 259
Test ran in 16ms
Do i have to consider something in the code? I want to test 1 line mode

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Thu Aug 24, 2017 12:49 pm

By default these tests use 4-line mode. You can edit test_sd.c and change peripheral configuration to 1-line mode.

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Thu Aug 24, 2017 1:07 pm

Its working. But i also added highspeed mode to a test case, but its still always default speed.
Name: SS08G
Type: SDHC/SDXC
Speed: default speed
Size: 30436MB

Code: Select all

TEST_CASE("can write and read back blocks", "[sd][ignore]")
{
    sdmmc_host_t config = SDMMC_HOST_DEFAULT();
    
   config.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
   
    config.flags = SDMMC_HOST_FLAG_1BIT;
    TEST_ESP_OK(sdmmc_host_init());
    sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
    TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
    sdmmc_card_t* card = malloc(sizeof(sdmmc_card_t));
    TEST_ASSERT_NOT_NULL(card);
    TEST_ESP_OK(sdmmc_card_init(&config, card));
    read_write_test(card);
    free(card);
    TEST_ESP_OK(sdmmc_host_deinit());
}

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: How to use test_sd.c

Postby ESP_igrr » Thu Aug 24, 2017 1:24 pm

In Github master version, high speed support is not implemented. Actually, we have just merged the change internally, which adds high speed mode support. We have some issues with tests now, but once they are resolved, you should be able to get new code from Github and it will support high speed mode.

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Re: How to use test_sd.c

Postby mattismyo » Thu Aug 24, 2017 1:24 pm

Thanks!

Who is online

Users browsing this forum: No registered users and 152 guests