Skip to main content
FW version: Stable

Bus analyzing examples

During the device integration, it is often useful to have the possibility to examine the communication buses in which the device is actively engaged. YOS offers several options on how to do so. This tutorial shows a few useful examples.

info
  • Let's presume that a successful comlink with the device was already established (the device is connected, connection options were set, the driver was installed, etc.)
  • Let's presume that you are familiar with the YOS scripting.

Setting up an interface

A few commands are offered to manipulate the interfaces and attached protocols. Please refer to Interface manipulation commands. The commands are:

  • msgconf - used to set up physical link parameters (e.g. CAN speed and timing, USART baud rate and frame configuration, etc).
  • protoconf - used to set up service protocol (enable/disable) for each interface individually
  • msginit - used to init/deinit an interface in the run-time

Binary sniffing

For evaluation, send and receive commands may be used to send and receive binary data through a selected interface.

tip

You may map these small snippets as preset scripts for easy starting and stopping.

Receive

  • Let's set up our device to sniff out the content of an incoming message via interface number 3 (CAN) with a specific CAN ID 1024:

    receive -i3 -f1 -s1024

    sniff

  • Let's say we want to sniff out more than one message. For such a case, we may specify a bit mask. The mask value defines which bits of the incoming SID must match the specified SID. This example prints out all incoming CAN messages with zeroes in SID following the 12th bit (SID is smaller than 4096):

    receive -i3 -f1 -s0 -t0xFFFFF000
  • Or simply, let's print all messages on CAN bus (by setting the mask to zero):

    receive -i3 -f1 -s0 -t0
  • In the following example, instead of printing to the terminal, the received payload will be stored inside a variable:

    AM-felix#>var mydata_rx.8 uint8
    AM-felix#>receive -i3 -f1 -s0x700 mydata_rx
  • To stop receiving, just type:

    receive -i0
info

The receive command may not work within reserved SID space (occupied by siliXcon service protocol).

Send

  • Send 3 bytes (values 15, 15 and 0x84) via interface number 3 (CAN) and sid 2 (which translates to CAN ID 2):

    send -i3 -f1 -s2 15 15 0x84
  • Do the same on USART (for sending raw characters, specify flag to 255 to disable link addressing):

    send -i1 -f255 15 15 0x84
  • Create an array variable with 8 bytes, fill in some data and send it through CAN (on the CAN ID 0x700):

    AM-felix#>var mydata_tx.8 uint8
    AM-felix#>set mydata_tx.0 0x10
    AM-felix#>set mydata_tx.1 0x20
    AM-felix#>
    AM-felix#>send -i3 -f1 -s0x700 mydata_tx
warning

Sending messages can affect the vehicle operation and may induce unwanted acceleration.