This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a85168b7832 drivers/can/ctucanfd: Re-enable RX interrupts without
pending RX frames.
a85168b7832 is described below
commit a85168b78325c422afc0becc83470065feadc24b
Author: raiden00pl <[email protected]>
AuthorDate: Tue Oct 13 20:35:50 2026 +0200
drivers/can/ctucanfd: Re-enable RX interrupts without pending RX frames.
The cores of a card share one IRQ and ctucanfd_interrupt() disables RX
interrupts on all of them. The socket path re-enabled them only in
ctucanfd_sock_recv(), so a core whose INT_STAT had no RX event (RBNEI,
or the error bits with NET_CAN_ERRORS) and no sent buffer kept RX off
until its next TX completion. INT_MASK stays 0, so INT_STAT also
latches events that are not enabled ("To set the Interrupt status, its
corresponding bit of Interrupt mask must be 0").
https://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/doc/Datasheet.pdf
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <[email protected]>
---
drivers/can/ctucanfd_pci.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/can/ctucanfd_pci.c b/drivers/can/ctucanfd_pci.c
index bde1f0c002e..95a7c33cf4f 100644
--- a/drivers/can/ctucanfd_pci.c
+++ b/drivers/can/ctucanfd_pci.c
@@ -1662,11 +1662,17 @@ static void ctucanfd_sock_interrupt(FAR struct
ctucanfd_driver_s *priv)
ctucanfd_putreg(&priv->devs[i], CTUCANFD_INTSTAT, stat);
- /* Re-enable TX interrupts.
- * NOTE: RX interrupts are re-enabled in ctucanfd_sock_recv.
+ /* Re-enable TX interrupts. Re-enable RX interrupts too unless
+ * RBNEI is pending; then ctucanfd_sock_recv() re-enables them once
+ * the RX buffer is drained.
*/
ctucanfd_txint(&priv->devs[i], true);
+
+ if ((stat & CTUCANFD_INT_RBNEI) == 0)
+ {
+ ctucanfd_rxint(&priv->devs[i], true);
+ }
}
}
#endif /* CONFIG_CAN_CTUCANFD_SOCKET */