You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/05/31 18:53:06 UTC

[nuttx] 04/05: mpfs/CoreSPI: Fix bug when waiting for last character to arrive

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fc5e8ff8f89eeaaa2d61a00e56d22f4ec25fb29c
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Mon May 22 17:30:10 2023 +0300

    mpfs/CoreSPI: Fix bug when waiting for last character to arrive
    
    The logic for rx_fifo_empty is wrong, needs a loop for the retry to work
---
 arch/risc-v/src/mpfs/mpfs_corespi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/risc-v/src/mpfs/mpfs_corespi.c b/arch/risc-v/src/mpfs/mpfs_corespi.c
index 85f77951b7..b5f850dd13 100644
--- a/arch/risc-v/src/mpfs/mpfs_corespi.c
+++ b/arch/risc-v/src/mpfs/mpfs_corespi.c
@@ -781,8 +781,7 @@ static void mpfs_spi_unload_rx_fifo(struct mpfs_spi_priv_s *priv,
 
   for (i = 0; i < nwords; i++)
     {
-      rx_fifo_empty = getreg32(MPFS_SPI_STATUS) & MPFS_SPI_RXEMPTY;
-      if (rx_fifo_empty)
+      while ((rx_fifo_empty = getreg32(MPFS_SPI_STATUS) & MPFS_SPI_RXEMPTY))
         {
           /* Last RX character not ready yet, try again (once) */