Skip to content

Commit

Permalink
[REVERTME] arch/risc-v/src/mpfs/mpfs_corespi.c: Hack around a bug in …
Browse files Browse the repository at this point in the history
…nuttx nxsem_tickwait_uninterruptible bug

The nxsem_tickwait_uninterruptible seems to timeout randomly one tick too soon. Add one tick to timeout to make sure it is long enough.

This can be reverted when the actual bug is fixed.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed May 17, 2023
1 parent 2665ecb commit c9a794c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arch/risc-v/src/mpfs/mpfs_corespi.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,13 @@ static int mpfs_spi_sem_waitdone(struct mpfs_spi_priv_s *priv)
{
uint32_t timeout = SPI_TTOA_US(priv->txwords * priv->nbits, priv->actual);
timeout += SPI_TTOA_MARGIN_US;
return nxsem_tickwait_uninterruptible(&priv->sem_isr, USEC2TICK(timeout));

/* Hack: add +1 to timeout due to some bug in NuttX. It randomly timeouts
* one tick too early
*/

return nxsem_tickwait_uninterruptible(&priv->sem_isr, USEC2TICK(timeout) +
1);
}

/****************************************************************************
Expand Down

0 comments on commit c9a794c

Please sign in to comment.