aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-08-25 08:48:13 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-08-25 08:48:13 +0000
commitd495a2ce4ef84fccdebe1e24b9552c10ee2cde93 (patch)
treed97ae08a90a6f2f44a58c295a7dd987d03da602e
parentaa5b03d54d50e12fef3d0734d9afd2ff3a13c967 (diff)
downloadChibiOS-d495a2ce4ef84fccdebe1e24b9552c10ee2cde93.tar.gz
ChibiOS-d495a2ce4ef84fccdebe1e24b9552c10ee2cde93.tar.bz2
ChibiOS-d495a2ce4ef84fccdebe1e24b9552c10ee2cde93.zip
Fixed bug #879.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10486 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.c5
-rw-r--r--os/hal/ports/STM32/LLD/SPIv2/hal_spi_lld.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.c b/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.c
index 0cee5729b..067651691 100644
--- a/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.c
+++ b/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.c
@@ -443,8 +443,9 @@ void spi_lld_stop(SPIDriver *spip) {
if (spip->state == SPI_READY) {
/* SPI disable.*/
- spip->spi->CR1 = 0;
- spip->spi->CR2 = 0;
+ spip->spi->CR1 &= ~SPI_CR1_SPE;
+ spip->spi->CR1 = 0;
+ spip->spi->CR2 = 0;
dmaStreamRelease(spip->dmarx);
dmaStreamRelease(spip->dmatx);
diff --git a/os/hal/ports/STM32/LLD/SPIv2/hal_spi_lld.c b/os/hal/ports/STM32/LLD/SPIv2/hal_spi_lld.c
index b3aafff07..01f894970 100644
--- a/os/hal/ports/STM32/LLD/SPIv2/hal_spi_lld.c
+++ b/os/hal/ports/STM32/LLD/SPIv2/hal_spi_lld.c
@@ -440,13 +440,15 @@ void spi_lld_start(SPIDriver *spip) {
* @notapi
*/
void spi_lld_stop(SPIDriver *spip) {
+ uint32_t cr1;
/* If in ready state then disables the SPI clock.*/
if (spip->state == SPI_READY) {
/* SPI disable.*/
- spip->spi->CR1 = 0;
- spip->spi->CR2 = 0;
+ spip->spi->CR1 &= ~SPI_CR1_SPE;
+ spip->spi->CR1 = 0;
+ spip->spi->CR2 = 0;
dmaStreamRelease(spip->dmarx);
dmaStreamRelease(spip->dmatx);