From d47ce46522242c3be16aacafcdb5b978ff91c018 Mon Sep 17 00:00:00 2001
From: gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>
Date: Sun, 26 Oct 2014 11:50:09 +0000
Subject: Fixed bug #540.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7426 35acf78f-673a-0410-8e92-d51de3d6d3f4
---
 os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c b/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c
index e05b60cb7..2df416c2b 100644
--- a/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c
+++ b/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c
@@ -399,8 +399,15 @@ void i2s_lld_start_exchange(I2SDriver *i2sp) {
   size_t size = i2sp->config->size;
 
   /* In 32 bit modes the DMA has to perform double operations because fetches
-     are always performed using 16 bit accesses.*/
-  if ((i2sp->config->i2scfgr & (SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN)) != 0)
+     are always performed using 16 bit accesses.
+     DATLEN   CHLEN   SIZE
+     00 (16)  0 (16)  16
+     00 (16)  1 (32)  16
+     01 (24)  X       32
+     10 (32)  X       32
+     11 (NA)  X       NA
+     */
+  if ((i2sp->config->i2scfgr & SPI_I2SCFGR_DATLEN) != 0)
     size *= 2;
 
   /* RX DMA setup.*/
-- 
cgit v1.2.3