Old Lexar SDHC Cards write operation hangs on IMXRT-1050EVKB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Old Lexar SDHC Cards write operation hangs on IMXRT-1050EVKB

Jump to solution
1,907 Views
Takashi_Kashiwagi
Senior Contributor I

Hi everyone,

Now I am checking whether there are problems with Write / Read with various SD cards.

As mentioned in the title several cards encountered the following problems.

・Read operation has no problems, But 2nd Write Operation Hangs up.

・"SD_WaitWriteComplete" outputs error "Error: send CMD13 failed with host error 6502"

Q. Is there anyone who encountered similar problems?

Card Information as follows.

card->cid.manufacturerID    = 0x28
card->cid.applicationID     = 16965
card->cid.productName       =
card->cid.productVersion    = 16
card->cid.productSN         = 2600484995
SD_HOST_CLK_FREQ            = 198000000
card->busClock_Hz           = 49500000
card->version               = 8
card->currentTiming         = 1
card->operationVoltage      = 1
card->blockCount            = 31275008
card->blockSize             = 512
card->stat.speedClass       = 0x03
card->stat.uhsSpeedGrade    = 0x00

Best Regards,

T.Kashiwagi

1 Solution
1,711 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Igor

I found the cause!

In "BOARD_InitUSDHC" in Project Template(SDK_2.5.0_EVKB-IMXRT1050\boards\evkbimxrt1050\project_template), The following code was missing.

IOMUXC_SetPinMux(
        IOMUXC_GPIO_B1_14_USDHC1_VSELECT, /* GPIO_B1_14 is configured as USDHC1_VSELECT */
        0U);

In some sample projects there was the above code (ex. SDK_2.5.0_EVKB-IMXRT1050\boards\evkbimxrt1050\fatfs_examples\fatfs_sdcard\pin_mux.c).

By adding the above code, Old Lexar SDHC card can also be read and written.

Best Regards,

T.Kashiwagi

View solution in original post

0 Kudos
Reply
5 Replies
1,711 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Igor

Thank you for responding!

I understood that the write operation takes an unexpected time depending on the card.

and My understand is that SD_WaitWriteComplete is waiting complete the write operation by CMD13.

However, the error indicates that the CMD 13 itself has timed out.

(CTOE bit is 1 in INT_STATUS = 0x00010000).

In IMXRT1050RM Rev. 1, pp3412, 

Occurs only if no response is returned within 64 SDCLK cycles from the end bit of the command. If the
uSDHC detects a CMD line conflict, in which case a Command CRC Error shall also be set (as shown in
Interrupt Status (INT_STATUS) ), this bit shall be set without waiting for 64 SDCLK cycles. This is
because the command will be aborted by the uSDHC.
This bit will be not asserted in tuning process.
0b - No Error
1b - Time out

Q. Why did CMD 13 fail? If response does not come back within 64 SDCLK, how can I handle it?

Best Regards,

T.Kashiwagi

0 Kudos
Reply
1,711 Views
igorpadykov
NXP Employee
NXP Employee

Hi Kashiwagi

one can try to check sd data (where it fails) with logic ananyzer and compare

behaviour using good card and description in sd specification.

Other reason may be that this card does not fully comply with sd specification.

Best regards
igor

1,711 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Igor

 

Thank you for responding!

I got SD bus Analyzer. but Since there is no remaining time, the survey will be carried over to next year.

Have a happy new year! 

0 Kudos
Reply
1,712 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Igor

I found the cause!

In "BOARD_InitUSDHC" in Project Template(SDK_2.5.0_EVKB-IMXRT1050\boards\evkbimxrt1050\project_template), The following code was missing.

IOMUXC_SetPinMux(
        IOMUXC_GPIO_B1_14_USDHC1_VSELECT, /* GPIO_B1_14 is configured as USDHC1_VSELECT */
        0U);

In some sample projects there was the above code (ex. SDK_2.5.0_EVKB-IMXRT1050\boards\evkbimxrt1050\fatfs_examples\fatfs_sdcard\pin_mux.c).

By adding the above code, Old Lexar SDHC card can also be read and written.

Best Regards,

T.Kashiwagi

0 Kudos
Reply
1,711 Views
igorpadykov
NXP Employee
NXP Employee

Hi Takashi

some cards may require long and unpredictable times to write a block of data. After receiving a block of
data and completing the CRC check, the card will begin writing and hold the DAT0 line low if its write
buffer is full and unable to accept new data from a new WRITE_BLOCK command.
The host may deselect the card by issuing CMD7 to select a different card, then later return to
first card. More details can be found in sd specification.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------