Browse Source

drivers/spi: STM32: This solves SPI infinite loop on Tranceive

This commit loops on rx not empty only if rx_buf is enabled.
And if rx_buf is not enabled, it loops on tx empty status.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
pull/34731/head
Affrin Pinhero 4 years ago
parent
commit
50c2acbc03
  1. 6
      drivers/spi/spi_ll_stm32.c

6
drivers/spi/spi_ll_stm32.c

@ -294,9 +294,15 @@ static void spi_stm32_shift_m(SPI_TypeDef *spi, struct spi_stm32_data *data) @@ -294,9 +294,15 @@ static void spi_stm32_shift_m(SPI_TypeDef *spi, struct spi_stm32_data *data)
spi_context_update_tx(&data->ctx, 2, 1);
}
if (data->ctx.rx_buf) {
while (!ll_func_rx_is_not_empty(spi)) {
/* NOP */
}
} else {
while (!ll_func_tx_is_empty(spi)) {
/* NOP */
}
}
if (SPI_WORD_SIZE_GET(data->ctx.config->operation) == 8) {
rx_frame = LL_SPI_ReceiveData8(spi);

Loading…
Cancel
Save