You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/05/19 07:06:27 UTC
[mynewt-core] branch master updated: stm32/hal_spi: Enable SPI in
hal_spi_enable
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new ae300e2 stm32/hal_spi: Enable SPI in hal_spi_enable
ae300e2 is described below
commit ae300e25f63d76684ead8ad6c8a3df40d745a913
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri May 14 14:32:27 2021 +0200
stm32/hal_spi: Enable SPI in hal_spi_enable
Functions hal_spi_enable() and hal_spi_disable() did not do
anything useful.
Now like many other implementations (NRF, DA1469x) those functions
actually enable and disable SPI.
Without this change SPI peripheral could be enabled by
ST HAL functions like HAL_SPI_Transmit_Receive() but
if that was the case chip select would be asserted before
SPI peripheral was enabled.
In some cases it could lead to clock PIN going to inactive state
after chip select was active.
With this change SPI pins are in correct state before CS is activated during transmission.
---
hw/mcu/stm/stm32_common/src/hal_spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/mcu/stm/stm32_common/src/hal_spi.c b/hw/mcu/stm/stm32_common/src/hal_spi.c
index 9f0222d..8c5fd6d 100644
--- a/hw/mcu/stm/stm32_common/src/hal_spi.c
+++ b/hw/mcu/stm/stm32_common/src/hal_spi.c
@@ -532,7 +532,7 @@ hal_spi_enable(int spi_num)
rc = 0;
STM32_HAL_SPI_RESOLVE(spi_num, spi);
- /* XXX power up */
+ __HAL_SPI_ENABLE(&spi->handle);
err:
return rc;
}
@@ -554,7 +554,7 @@ hal_spi_disable(int spi_num)
rc = 0;
STM32_HAL_SPI_RESOLVE(spi_num, spi);
- /* XXX power down */
+ __HAL_SPI_DISABLE(&spi->handle);
err:
return rc;
}