Skip to content

Commit

Permalink
mimxrt/sdcard: Fix an error when writing large blocks.
Browse files Browse the repository at this point in the history
Which happened when a read followed a large write.
  • Loading branch information
robert-hh authored and dpgeorge committed Dec 14, 2022
1 parent 913f9ad commit aea4174
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ports/mimxrt/sdcard.c
Expand Up @@ -360,7 +360,8 @@ static status_t sdcard_transfer_blocking(USDHC_Type *base, usdhc_handle_t *handl
status = kStatus_Timeout;
for (int i = 0; i < timeout_ms * 100; i++) {
// Wait until Data0 is low any more. Low indicates "Busy".
if ((transfer->data->txData == NULL) || (USDHC_GetPresentStatusFlags(base) & (uint32_t)kUSDHC_Data0LineLevelFlag) != 0) {
if (((transfer->data->txData == NULL) && (transfer->data->rxData == NULL)) ||
(USDHC_GetPresentStatusFlags(base) & (uint32_t)kUSDHC_Data0LineLevelFlag) != 0) {
// Not busy anymore or no TX-Data
status = USDHC_TransferBlocking(base, &dma_config, transfer);
if (status != kStatus_Success) {
Expand Down

0 comments on commit aea4174

Please sign in to comment.