Skip to content

Readme.md protocol is not the same as implemented. ID assignment cause canbus collisions. #1

@bondus

Description

@bondus

In Readme.md it states that nodes should use id 0x17F+(2 x PortNumber). Neither the klipper code or this canserial code does that, they use 0x180+PortNumber, and 0x180+PortNumber+1 as a response ID.
Since they do not do that "x 2" and the CAN nodes responds to the host using canid+1 there will be ID collisions on the CAN bus if nodes get port numbers next to each other. Collisions leads to all kind of problems.

A very ugly small fix is a change in cansocket.c in ConfigurePort():

-       // port number + ID offset
-       int portid = PnGetNumber(frame.data);
+       // (port number*2) + ID offset
+       int portid = PnGetNumber(frame.data)*2;

Easiest is probably to fix this issue in canserial and leave the STM32 code alone.
I will make a better fix...

Are you still planning on maintaining this code? It's been a while since last modification

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions