RAK13006 CAN Bus fails to send after exactly 48 frames


I’ve run into a strange issue when sending messages over CAN bus.

When I run the example code from RAK13006_CAN_Master.ino it

  • sends 48 frames successfully (frames 1-48)
  • fails to send all additional frames (frames 49+)

I have tried using different CAN bit rates and different messages, but the result is the same. Only 48 frames are successfully sent. Never more, never less. Exactly 48 succeed.

I’m using

Any ideas what might cause this?

Thanks for your help :slight_smile:

I added this issue to the example code Github repo as well for additional visibility

As it turns out, the FIFO and TXQ buffers were overflowing due to the CAN Bus frames not successfully sending since I don’t have a CAN Bus device connected. What confused me is that Rak_Can.tryToSend (frame) returns 0 (no error) even when a CAN Bus device is not connected due to it placing the unsent messages in queues.

Part of why I am testing without a CAN Bus device connected is that I cannot rely on all messages being received and, for my use case, the most recent message is always the most important so dropping older messages is ok.

In the example code, retransmission attempts are set to UnlimitedNumber by default. I set the attempts to Disabled to resolve the issue. I have now sent over 1000 consecutive frames without issue.

Code to set the number of retransmission attempts (options are Disabled, ThreeAttempts, UnlimitedNumber):

RAK_CAN_Settings settings (RAK_CAN_Settings::OSC_40MHz, 125 * 1000) ;
settings.mControllerTransmitFIFORetransmissionAttempts = RAK_CAN_Settings::Disabled;
settings.mControllerTXQBufferRetransmissionAttempts = RAK_CAN_Settings::Disabled;
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.