python-can icon indicating copy to clipboard operation
python-can copied to clipboard

Support 11-bit identifiers in the serial interface

Open KB1RD opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

I'm working on a piece of software that will eventually run on a Raspberry Pi (ideally using the SocketCAN interface), but I would like to easily test on my local computer. I have several microcontrollers, but no way to connect the CAN bus to my computer. With the CAN serial interface, I can program the microcontrollers to act as an gateway for my computer, but the serial interface doesn't support 11-bit CAN IDs. Since my project uses 11-bit CAN IDs, I'm looking to add this support.

Describe the solution you'd like

I added support for 11-bit CAN IDs by placing them at the end of the arbitration_id space for 29-bit IDs, and using the 30th bit to enable 11-bit IDs. I thought it might be useful to others, so I tested and documented the change.

Describe alternatives you've considered

I have considered making a new interface that adds more features to serial. I have also considered using the SLCAN interface, but it's honestly easier to make this change than it is to implement full SLCAN compatibility.

Additional context

I am new to this project, and I'm not sure if this is a feature that is really wanted in the upstream. If it is, feel free to make edits to this PR.

KB1RD avatar Mar 16 '24 23:03 KB1RD