Skip to content

examples: add CAN FD support to ServoNode and fix Linux drivers for CAN FD - #95

Open
rishabsingh3003 wants to merge 3 commits into
dronecan:masterfrom
rishabsingh3003:servo-canfd
Open

rishabsingh3003 wants to merge 3 commits into
dronecan:masterfrom
rishabsingh3003:servo-canfd

Conversation

@rishabsingh3003

Copy link
Copy Markdown

No description provided.

LinuxCANInit passed can_fd to the mcast and socketcan init functions,
but the parameter is named canfd, so the driver failed to compile
with CANARD_ENABLE_CANFD=1
The canfd flag of a received frame was never set, so FD transfers
were decoded using the classic CAN tail array optimisation rules.

A CAN FD socket also delivers classic frames, which are shorter than
struct canfd_frame. These were rejected with -EIO, which stopped a
node from receiving classic frames from other nodes on the bus.
Adding canfd as a second argument sends all transfers as CAN FD
frames. Without it the behaviour is unchanged.

When sending CAN FD the messages are encoded without tail array
optimisation. A CAN FD frame is padded to the next valid length, so
the receiver cannot work out the length of a trailing array from the
transfer length, and DroneCAN GUI Tool fails to decode the transfer
with "Not enough bits".

Node ID allocation requests are still sent as classic CAN, as the
request is hand-encoded for 8 byte frames.

The memory pool is larger as the block size goes from 32 to 128
bytes when CAN FD is enabled. With the old 1024 byte pool a
GetNodeInfo response no longer fits in the transmit queue when
sending classic CAN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant