Distinguishing between DroneCAN and OpenCyphal frames?

I’m updating a product that must support receiving both DroneCAN and OpenCyphal CAN frames.

Whenever a CAN frame arrives, my code should decide whether to feed it into a DroneCAN or OpenCyphal libcanard instance.

I can already determine the protocol of the first frame of each transfer by checking the toggle bit. DroneCAN starts at 0 and the toggle bit of OpenCyphal starts at 1.

However, I want to be able to distinguish the protocol of each frame even if transfers of two different protocols are interleaved. Is there a simple way to do this?

I assume that, for example, feeding a DroneCAN frame into an OpenCyphal libcanard instance would confuse that instance (or vice versa). Am I right here?

Such non-first frames can be fed into both protocol state machines simultaneously. The wrong instance will simply drop the frame because it will have no matching transfer reassembly state machine for it.

1 Like

Thanks Pavel!