Skip to content

Commit

Permalink
drivers/spi: STM32: This solves SPI infinite loop on Tranceive
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
affrinpinhero-2356 authored and galak committed May 11, 2021
1 parent 13303c4 commit 0129884
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/spi/spi_ll_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,14 @@ static void spi_stm32_shift_m(SPI_TypeDef *spi, struct spi_stm32_data *data)
spi_context_update_tx(&data->ctx, 2, 1);
}

while (!ll_func_rx_is_not_empty(spi)) {
/* NOP */
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) {
Expand Down

0 comments on commit 0129884

Please sign in to comment.