CAN FD 66 frame no data on Canbus Monitor

I have modified the GitHub Arduino example to send CAND FD on the serial port. I am not able to view anything on the can monitor. The following function is used to send the frames:

void SendCANFrameToSerialFD(unsigned long canFrameId, const byte* frameData)
{
  // the 4 byte identifier at the beginning of each CAN frame
  // this is required for RealDash to 'catch-up' on ongoing stream of CAN frames
  const byte serialBlockTag[3] = { 0x66, 0x33, 0x22}; 
  Serial.write((const byte*)&serialBlockTag, 3);

 // the CAN FD frame length
  const byte serialFDLength[1] = { 0x13 }; 
  Serial.write((const byte*)&serialFDLength, 1);
  
   // the CAN frame id number (as 32bit little endian value)
  Serial.write(canFrameId, 4);
  
  // CAN frame payload
  Serial.write(frameData, 16);
  
  // Write CAN FD crc
  uint32_t checksum = Crc32(frameData, 16); 
 
  Serial.write((byte *) &checksum, 4);

}

Sending 16bytes of 0x00 the serial monitor prints the following:


66 33 22 13 80 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 4B BB EC

I can’t seem to get the canbus monitor to display any data. The normal Arduino function SendCANFramesToSerial() in the example works when I only send 8bytes per frame.

Seems like you calculate the CRC from 16 bytes, but it needs to be calculated from all bytes of the package.

Thanks. I re read the github docs and misunderstood the explanation of the CRC. I will try that. Can more that 8 bytes be sent in a realdash 44 frame?

The XML documentation alludes to it being possible, but the can protocol documentation doesn’t explain how to accomplish it. I would rather push the can frames without calculating the CRC.

Is the 4th byte on the 44 frame modified for the data length and sent as normal?

Is the XML file adjusted for all bytes in the frame to fit under one baseId and offsets set accordingly when transferring more than 8 bytes of data ?

frame 'size' attribute (optional)
Typically CAN frames contain 8 byte payload. When connecting directly to a CAN device with supported CAN Adapters, a CAN frame may contain less than standard 8 bytes. Also, when using RealDash CAN protocol CAN frame may contain up to 64 bytes of payload data. While it is not required to set the size attribute when using RealDash CAN protocol and frame is larger than 8 bytes, it is a good practise to ensure compatibility with possible CAN FD compatible adapters.

The size attribute can be used to specify a custom number (1-64) of bytes contained by CAN frame:

<frame id="3200" size="6">
1 Like

I have updated the function to calculate the CRC from all frame bytes and it works. Thanks.

RealDash CAN ‘44’ frame always contains 8 bytes payload. No less, no more.

Although, when you connect to other CAN devices, they may contain less or more than 8 (CAN FD) bytes. That is a reason you can define a length of CAN frame in XML file.

But as docs say, you typically do not need to do that. RealDash receives the frames in a size that they come in, and reads values with offsets and lengths specified in XML.

1 Like