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

Old SD card doesn't support CMD25, WRITE_MULTIPLE_BLOCK #666

Closed
ChenHsiang opened this issue Aug 2, 2018 · 2 comments
Closed

Old SD card doesn't support CMD25, WRITE_MULTIPLE_BLOCK #666

ChenHsiang opened this issue Aug 2, 2018 · 2 comments

Comments

@ChenHsiang
Copy link

I noticed that sdio_write_sectors() return error when I using my lower end SD cards. My no-brand 128Mb and 256Mb cards having issue on f_mkdir() and the root cause is error in sdio_write_sectors(). To fix the issue, I have to replace the CMD25 (WRITE_MULTIPLE_BLOCK) with multiple CMD24 (single WRITE_BLOCK) to overcome the issue.
To increase the compatability on different SD Cards, may I propose the change to replace CMD25?

(sdio_write_sectors() in extras/sdio/sdio.c)

#if 0
    if (command(card, CMD25, sector))
        return set_error(card, SDIO_ERR_IO);

    while (count--)
    {
        if (write_data_block(card, TOKEN_MULTI_TRAN, src) != SDIO_ERR_NONE)
            return card->error;
        src += SDIO_BLOCK_SIZE;
    }
    spi_transfer_8(BUS, TOKEN_STOP_TRAN);
#else
    // CHEN: Lower end card (EX: 128Mb) doesn't support
    //       multiple block write (CMD25)
    while (count--)
    {
        // single block
        if (command(card, CMD24, sector)) {
            return set_error(card, SDIO_ERR_IO);
        }
        if (write_data_block(card, TOKEN_SINGLE_TRAN, src) != SDIO_ERR_NONE)
            return card->error;
        src += SDIO_BLOCK_SIZE;
    }
#endif

@UncleRus
Copy link
Member

UncleRus commented Aug 2, 2018

Workarounded in #667, please test

@UncleRus
Copy link
Member

Feel free to reopen issue if the error persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants