bldc icon indicating copy to clipboard operation
bldc copied to clipboard

Multiple CAN RX buffers

Open rpasichnyk opened this issue 4 years ago • 2 comments

This issue will become more problematic since the number of CAN devices increases. When talking to VESC each device that sends a command that does not fit into a single payload wants to use rx_buffer. If those devices send at the same time, buffer will contain mixed data and nothing will work.

I create this issue to brainstorm possible solutions to this problem before working on a pull request. What can be done?

One simple idea is introducing rx_buffer1, CAN_PACKET_FILL_RX_BUFFER1, rx_buffer2, CAN_PACKET_FILL_RX_BUFFER2, etc. or maybe something more flexible like CAN_PACKET_FILL_RX_BUFFER_N where each frame contains buffer number?

What are your thoughts on this?

rpasichnyk avatar Jul 02 '21 08:07 rpasichnyk

In industrial application, people use something like CANopen. Maybe we can take a look at how they implemented it? (If only VESC is CANopen compatible)

supercrazysam avatar Aug 06 '21 22:08 supercrazysam

Here is an attempt at multiple buffers: https://github.com/vedderb/bldc/commit/0dec878d1d335485ac3f313b4136c8e8bd354477 It is not foolproof, but seems to work much better so far. It is also backwards compatible, which is important.

vedderb avatar Jan 02 '23 12:01 vedderb