mac-can / PCBUSB-Library

macOS® User-Space Driver for PCAN-USB Interfaces (Binaries only)
https://mac-can.com
Other
29 stars 0 forks source link

Messages lost on high CAN FD bit-rates #9

Closed mac-can closed 2 years ago

mac-can commented 2 years ago

Testcase TC12.6 failed: expected != received

TC12.6 - Read CAN FD messages from the receive queue and check for amount and order:

Assumption: It seems that the CAN FD capable PCAN USB devices send greater URBs than they report as endpoint packet size (512 byte. for pipe 3: input pipe for received CAN messages). The PCBUSB library provides a double buffer with size of 512 bytes (each). One buffer can hold up to 4 CAN FD message entries of 96 bytes but occasionally there is an incomplete 5th one in the packet. An incomplete entry could not be decoded, so this message get lost.

mac-can commented 2 years ago

Rootcause: With bulk transfers there can be more than one packet in an URB!

  1. PCAN-USB (not CAN FD capable):
    Default packet size is 64 bytes, but up to 512 bytes are possible within one bulk transfer (needed packet by packet for decoding).
  2. PCAN-USB FD and PCAN-USB Pro FD:
    Default packet size is 512 bytes, but up to 1024 bytes are possible within one bulk transfer (needed in one piece for decoding).

Solution: Will be fixed with version 0.11.2.

mac-can commented 2 years ago

Bug fix release v0.11.2 available. Issue can be closed.