From 16946c08516ad1623649db868f053d9ea0c921a5 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 14 Mar 2020 09:58:51 +0000 Subject: [PATCH] Write now working. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13415 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/hal/ports/STM32/LLD/SDMMCv2/hal_sdc_lld.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/os/hal/ports/STM32/LLD/SDMMCv2/hal_sdc_lld.c b/os/hal/ports/STM32/LLD/SDMMCv2/hal_sdc_lld.c index 26ee52606..3cad0d3a4 100644 --- a/os/hal/ports/STM32/LLD/SDMMCv2/hal_sdc_lld.c +++ b/os/hal/ports/STM32/LLD/SDMMCv2/hal_sdc_lld.c @@ -746,11 +746,7 @@ bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk, SDMMC_MASK_DATAENDIE; sdcp->sdmmc->DLEN = blocks * MMCSD_BLOCK_SIZE; - /* Talk to card what we want from it.*/ - if (sdc_lld_prepare_write(sdcp, startblk, blocks, resp) == true) - goto error; - - /* Transaction starts just after DTEN bit setting.*/ + /* Transfer modes.*/ sdcp->sdmmc->DCTRL = SDMMC_DCTRL_DBLOCKSIZE_3 | SDMMC_DCTRL_DBLOCKSIZE_0; @@ -758,6 +754,9 @@ bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk, sdcp->sdmmc->IDMABASE0 = (uint32_t)buf; sdcp->sdmmc->IDMACTRL = SDMMC_IDMA_IDMAEN; + if (sdc_lld_prepare_write(sdcp, startblk, blocks, resp) == true) + goto error; + if (sdc_lld_wait_transaction_end(sdcp, blocks, resp) == true) goto error;