Skip to content

Commit 2160134

Browse files
jhokajarstevew817
authored andcommitted
Silabs: SPI DMA fix
DMA tranfer was not working in Geckos using DMA. Changed transfer length calculation in function spi_activate_dma.
1 parent 0dfca1a commit 2160134

File tree

1 file changed

+2
-2
lines changed
  • libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32

1 file changed

+2
-2
lines changed

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ static void spi_activate_dma(spi_t *obj, void* rxdata, const void* txdata, int t
10061006
false,
10071007
(obj->spi.bits <= 8 ? (void *)&(obj->spi.spi->TXDATA) : (void *)&(obj->spi.spi->TXDOUBLE)), //When frame size > 9, point to TXDOUBLE
10081008
(txdata == 0 ? &fill_word : (void *)txdata), // When there is nothing to transmit, point to static fill word
1009-
(obj->spi.bits <= 8 ? tx_length - 1 : (tx_length / 2) - 1)); // When using TXDOUBLE, recalculate transfer length
1009+
(tx_length - 1));
10101010
} else {
10111011
/* Frame size == 9 */
10121012
/* Only activate RX DMA if a receive buffer is specified */
@@ -1044,7 +1044,7 @@ static void spi_activate_dma(spi_t *obj, void* rxdata, const void* txdata, int t
10441044
false,
10451045
(void *)&(obj->spi.spi->TXDATAX), //When frame size > 9, point to TXDOUBLE
10461046
(txdata == 0 ? &fill_word : (void *)txdata), // When there is nothing to transmit, point to static fill word
1047-
(tx_length / 2) - 1); // When using TXDOUBLE, recalculate transfer length
1047+
(tx_length - 1));
10481048
}
10491049
}
10501050
#endif //LDMA_PRESENT

0 commit comments

Comments
 (0)