Skip to content

Commit 3bcd490

Browse files
ABOSTMfpistm
authored andcommitted
spi: wait for end of transfer before returning from spi_transfer()
This guarantee to application that transfer is finished, and avoid for example that application releases NSS pin while transfer is still ongoing. Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 552a133 commit 3bcd490

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libraries/SPI/src/utility/spi_com.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ spi_status_e spi_transfer(spi_t *obj, uint8_t *tx_buffer, uint8_t *rx_buffer,
444444
LL_SPI_ClearFlag_TXTF(_SPI);
445445
/* Disable SPI peripheral */
446446
LL_SPI_Disable(_SPI);
447+
#else
448+
/* Wait for end of transfer */
449+
while (LL_SPI_IsActiveFlag_BSY(_SPI));
447450
#endif
448451

449452
return ret;

0 commit comments

Comments
 (0)