Skip to content

Commit

Permalink
arch/arm/src/stm32f7/: Fix data timeout errors with multiblock trans…
Browse files Browse the repository at this point in the history
…fers.
  • Loading branch information
feretich authored and gregory-nutt committed Jul 20, 2018
1 parent 4e92314 commit f9f56aa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions arch/arm/src/stm32f7/stm32_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@

/* Big DTIMER setting */

#define SDMMC_DTIMER_DATATIMEOUT (0x000fffff)
#define SDMMC_DTIMER_DATATIMEOUT (0x003d0900) /* 250 ms @ 16 MHz */

/* DMA channel/stream configuration register settings. The following
* must be selected. The DMA driver will select the remaining fields.
Expand Down Expand Up @@ -2271,8 +2271,8 @@ static int stm32_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Then set up the SDIO data path */

dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT;
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, nbytes, dblocksize |
STM32_SDMMC_DCTRL_DTDIR);
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT * ((nbytes + 511) >> 9),
nbytes, dblocksize | STM32_SDMMC_DCTRL_DTDIR);

/* And enable interrupts */

Expand Down Expand Up @@ -2326,7 +2326,8 @@ static int stm32_sendsetup(FAR struct sdio_dev_s *dev, FAR const
/* Then set up the SDIO data path */

dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT;
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, nbytes, dblocksize);
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT * ((nbytes + 511) >> 9),
nbytes, dblocksize);

/* Enable TX interrupts */

Expand Down Expand Up @@ -3040,8 +3041,8 @@ static int stm32_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Then set up the SDIO data path */

dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT;
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, buflen, dblocksize |
STM32_SDMMC_DCTRL_DTDIR);
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT * ((buflen + 511) >> 9),
buflen, dblocksize | STM32_SDMMC_DCTRL_DTDIR);

/* Configure the RX DMA */

Expand Down Expand Up @@ -3133,7 +3134,8 @@ static int stm32_dmasendsetup(FAR struct sdio_dev_s *dev,
/* Then set up the SDIO data path */

dblocksize = stm32_log2(priv->blocksize) << STM32_SDMMC_DCTRL_DBLOCKSIZE_SHIFT;
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT, buflen, dblocksize);
stm32_dataconfig(priv, SDMMC_DTIMER_DATATIMEOUT * ((buflen + 511) >> 9),
buflen, dblocksize);

/* Configure the TX DMA */

Expand Down

0 comments on commit f9f56aa

Please sign in to comment.