clarification of CAN interface commands
Can you please help send example statements for interactions with CAN bus?
Specifically, how do canMatch and canSend work with respect to these parameters?
msgId. How do I format this? Something like 0x012 or 12.
b bytes [<b> <b> ...]: How do I format this? something like [00 01 10 40]?
I'm somewhat expecting an interaction with a DUT to look like this.
#DUT configured to run at baudrate 500000
- command: canCfg CAN0 500000
- command: canSend CAN0 12 [00 01 10 40]
# DUT receives msgID (decimal) 12 and payload of 4 bytes [00 01 10 40]
- command: canClear CAN0
#DUT sends CAN message with msgID 10 and paylod of 3 bytes, formatted as ASCII "ABC"
- command: canMatch CAN0 10 [41 42 43]
-
Official comment
Please refer to our updated documentation of `canSend` and `canMatch`, as well as new CAN interaction examples:
Comment actions -
As a followup on this, I've been able to get this set command to execute:
- command: canCfg CAN0 500000
- command: operator "canSEND"
- command: canSend CAN0 1 12But I'm generally confused of what the '12' represents in the data field of the canbus dataframe.
Is it two ascii characters, '1' and '2'? Is it interpreted as the 12(decimal)? Or Hex 0x12?Also for reference, I believe the following commands all experienced parsing errors in my exploration to try to get something to be sent.
- command: canSend CAN0 1 50 4C
- command: canSend CAN0 1 50 4C 12 45
- command: canSend CAN0 1 50 1234 -
Thanks for pointing this out! We're updating our CAN command documentation to cover this, and include some examples.
The piece we didn't explain in the docs is that the msgID and payload bytes can be specified as integer, hex, or binary, using the appropriate prefix. Here are some examples:
# Integers
- command: canSend CAN0 566 1 23 45
# Hex
- command: canSend CAN0 0x123 0x00 0x01 0x02 0x03
# Binary
- command: canSend CAN0 0b101001 0b11100 0b00001
Please sign in to leave a comment.
Comments
3 comments