-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WrongSequenceNumberError #66
Comments
Hi CAN is designed to be reliable. Unwanted unordered message is a serious weakness. |
Will you post a link to that document? I don't have enough context. CAN doesn't have sequence numbers. |
This is ISO-15765-2:2016, the standard that defines the ISO-TP protocol. Unfortunately, the document is licensed, but if you look hard enough, you may find something, some chinese friends are not as respectful of western paywall as good will would dictate ;) . ISO-TP is a transport layer that goes above CAN layer. Sequence number is defined in the IsoTP protocol only. |
Although, you said something that struck me: "..so it is the task of the driver to send them through the same mailbox" One of my devices is SLCAN, and I'll need to check it's code. My third device, which is a socketCAN device is working perfectly. I am going to chase down the mailbox issue. Thanks for the tip! I almost didn't post anything at all and I would have been frustrated trying to solve this. |
Alright! Keep me updated. |
It looks like I have a bit of coding to do to - but I can verify the backend code is using whatever mailbox it wants. I am going to have to write some code to handle this, which is inconvenient. |
Generally, what I see is that there's a queue for each Transmit mailbox, then each message ID is assigned to a specific mailbox, meaning it is affected to the right queue, then the driver pops from queue A to write to mailbox A, queue B for mailbox B, etc. |
If I can add, generally, you need very few Transmit mailbox and a lot of receive mailbox. If your software is able to write to the mailbox as fast as the CAN bus transmit, you only need 1 mailbox. Adding mailboxes just reduces the number of interrupt/polling call t the driver. 4 is, I think, enough for most use case. |
@jagauthier : Do you care sharing the root cause how you fixed it? |
In my ecosystem I am using STM32 MCPUs which have bxCAN hardware in them. In this CAN messaging system there are transmit mailboxes. Using the built-in API provided by STM32 to submit a CAN message to a mailbox did not allow you to specify the mailbox, nor have any control over it. So you could submit 3 messages, and each message would go to a different mailbox and those mailboxes would not have a particular sending priority. Therefore, message 3 might be sent before message 1. This, obviously, breaks ISOTP. Moving forward, I've changed my STM32 ecosystem to only using their CANFD implementation. Their CANFD implementation does not use mailboxes, and instead it uses a FIFO. This eliminates the problem and vastly simplified my code. Plus, their CANFD implementation has more robust filtering available. So, I only use STM32 MCPUs with CANFD capabilities now. (STM32G series, for instance) |
Very interesting! Thank you for the feedback, might be useful to others |
I realize this error condition is intentional. But, by nature CAN may not send messages orderly.
I was able to trigger this with a simple message:
candump shows:
The text was updated successfully, but these errors were encountered: