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 c929cc6eb7a drivers/can/ctucanfd: Read RX frames on RBNEI in the 
character driver.
c929cc6eb7a is described below

commit c929cc6eb7ae81368725e98a52ff2c6ffa061fef
Author: raiden00pl <[email protected]>
AuthorDate: Tue Oct 13 19:50:20 2026 +0200

    drivers/can/ctucanfd: Read RX frames on RBNEI in the character driver.
    
    The character driver enables only RBNEI for RX but read the RX buffer
    only on RXI.  A frame whose RXI was already cleared kept RBNEI set, so
    the interrupt fired again and again without the frame being read and
    the node stopped responding until the next frame arrived.  Read on RXI
    or RBNEI.
    
    CTU CAN FD datasheet, INT_STAT: "RBNEI RX buffer not empty interrupt.
    Clearing this interrupt and not reading out content of RX Buffer via
    RX_DATA will re-activate the interrupt."
    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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/can/ctucanfd_pci.c b/drivers/can/ctucanfd_pci.c
index 9c2cf4b7e58..ea214a8aea8 100644
--- a/drivers/can/ctucanfd_pci.c
+++ b/drivers/can/ctucanfd_pci.c
@@ -952,9 +952,11 @@ static void ctucanfd_chardev_interrupt(FAR struct 
ctucanfd_driver_s *priv)
           continue;
         }
 
-      /* Frame received */
+      /* Frame received.  RBNEI stays set while the RX buffer is not empty,
+       * RXI may be already cleared for frames still in the buffer.
+       */
 
-      if (stat & CTUCANFD_INT_RXI)
+      if (stat & (CTUCANFD_INT_RXI | CTUCANFD_INT_RBNEI))
         {
           ctucanfd_chardev_receive(&priv->devs[i]);
         }

Reply via email to