stm32_common/spi: fix receive after transmit-only error
This commit is contained in:
parent
1b2b5d9df9
commit
465f2710c6
@ -172,6 +172,7 @@ void spi_transfer_bytes(spi_t bus, spi_cs_t cs, bool cont,
|
|||||||
*DR = outbuf[i];
|
*DR = outbuf[i];
|
||||||
}
|
}
|
||||||
/* wait until everything is finished and empty the receive buffer */
|
/* wait until everything is finished and empty the receive buffer */
|
||||||
|
while (!(dev(bus)->SR & SPI_SR_TXE)) {}
|
||||||
while (dev(bus)->SR & SPI_SR_BSY) {}
|
while (dev(bus)->SR & SPI_SR_BSY) {}
|
||||||
while (dev(bus)->SR & SPI_SR_RXNE) {
|
while (dev(bus)->SR & SPI_SR_RXNE) {
|
||||||
dev(bus)->DR; /* we might just read 2 bytes at once here */
|
dev(bus)->DR; /* we might just read 2 bytes at once here */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user