canMatch - Match received CAN message
Test if a particular CAN message has been received.
The PLT keeps only the single most recently received frame for each Arbitration ID on port.
canMatch polls that retained frame — it does not search a history of previously received
frames — so if several frames with the same msgId arrive, only the latest one is checked. Use
canClear - Clear CAN Buffer beforehand to ensure a stale frame with the same ID doesn’t cause a false match.
If the b payload bytes are omitted, the command succeeds as soon as any frame with the matching msgId is received, regardless of payload. If b bytes are given, they are matched against the received frame’s payload as an exact-value prefix: the received payload must be at least as long as the number of b bytes supplied, and each supplied byte must equal the received byte at the same position. Trailing received bytes beyond the supplied b bytes are ignored — there is no partial-byte/wildcard mask. To check specific bytes without constraining the ones before them, supply all preceding bytes as well.
The command polls port until a matching frame arrives or the step times out. If no timeout:
is set on the step, it defaults to 3 seconds.
Usage:
- command: canMatch <port> <msgId> [<b> <b> ...]
[extractKey: <key>]
[retry: <retryCount>]
Argument |
Description |
|---|---|
port |
CAN port name: |
msgId |
CAN Message Arbitration ID (11-bit standard or 29-bit extended). Can be specified as a
decimal, hex, or binary number, depending on prefix. Use |
b |
Payload bytes to match against a prefix of the received frame’s data, in order,
starting at byte 0. Each byte can be specified as a decimal, hex, or binary number,
depending on prefix. Use |
key |
Key in which to store the matching CAN message’s payload, as a hex string (optional) |
retryCount |
Number of times to retry the test step (optional) |
Note
The built-in CAN0 port does not support CAN-FD, so received frames on CAN0 are
limited to 8-byte Classic CAN payloads. Frames longer than 8 bytes require an externally-
attached USB CAN-FD dongle configured with FD via canCfg - Configure CAN interface.
Examples