stm32f4 SDK; when transmitting as slave, write first byte to DR
right away, without waiting for TXE.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/fb862311
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fb862311
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fb862311

Branch: refs/heads/develop
Commit: fb8623112f12b48fcb7cddb91118a6bc734f19bd
Parents: 4b468ce
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Oct 17 23:08:48 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Oct 17 23:15:07 2016 -0700

----------------------------------------------------------------------
 .../ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c   | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fb862311/hw/mcu/stm/stm32f4xx/src/ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
----------------------------------------------------------------------
diff --git 
a/hw/mcu/stm/stm32f4xx/src/ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
 
b/hw/mcu/stm/stm32f4xx/src/ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
index 5d1a139..84f9597 100644
--- 
a/hw/mcu/stm/stm32f4xx/src/ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
+++ 
b/hw/mcu/stm/stm32f4xx/src/ext/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
@@ -1100,6 +1100,9 @@ HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef 
*hspi, uint8_t *pData, u
     __HAL_SPI_ENABLE_IT(hspi, (SPI_IT_TXE | SPI_IT_ERR));
   }
 
+  if ((hspi->Instance->CR1 & SPI_CR1_MSTR) == 0) {
+      hspi->TxISR(hspi);
+  }
   /* Check if the SPI is already enabled */
   if((hspi->Instance->CR1 &SPI_CR1_SPE) != SPI_CR1_SPE)
   {
@@ -1277,6 +1280,9 @@ HAL_StatusTypeDef 
HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *p
   /* Enable TXE, RXNE and ERR interrupt */
   __HAL_SPI_ENABLE_IT(hspi, (SPI_IT_TXE | SPI_IT_RXNE | SPI_IT_ERR));
 
+  if ((hspi->Instance->CR1 & SPI_CR1_MSTR) == 0) {
+      hspi->TxISR(hspi);
+  }
   /* Check if the SPI is already enabled */
   if((hspi->Instance->CR1 &SPI_CR1_SPE) != SPI_CR1_SPE)
   {

Reply via email to