5 - Creating Ethernet Receive Messages and Decoding Signals
Last updated
Last updated
Copyright © 2024 | All Rights Reserved
In the preceding chapters we have learned how to view and work with live Ethernet messages on an Internet connection. You can work with your automotive network in exactly the same way, going online and monitoring network traffic. When working with actual ECUs and other Ethernet nodes, however, you will often want to create Vehicle Spy receive messages that describe particular message types and provide information for VSpy to decode their contents.
This can be accomplished with Ethernet messages in a manner similar to how you have traditionally worked with CAN and other network data. However, due to the complexity of many Automotive Ethernet message formats, Intrepid has added special capabilities to make working with Ethernet messages more user-friendly.
In this chapter we’ll see how to define an Ethernet receive message, add a signal to it, and then decode Ethernet data using the message definition. We have created a special data buffer of Ethernet messages and put it on our website to assist with this demonstration. Before proceeding, please download the file from the following location, and store it in your data directory or anywhere else on your PC: https://www.intrepidcs.com/ae/ethernet_data.vsb
We’ll begin by defining a basic Ethernet receive message. Again, the process is very similar to doing this for a CAN message, so assuming you have some VSpy experience, much of the following should be familiar.
Let’s clear out anything that may already be present within Vehicle Spy, and then go to the Messages Editor.
► Reset Vehicle Spy to Start Configuration: Select New from the File menu.
► Open Messages Editor: Select Messages Editor from the Spy Networks menu.
Since we want to work with Ethernet, we will change the default in the on Network drop-down box from the default of “HS CAN” to “Ethernet”.
► Select Ethernet Network: Click the drop-down box in the blue header and scroll down until you find the “Ethernet” entry, then select it.
We should already be on the “receive side” of the Messages Editor, as indicated by the blue highlighting on the button. If for some reason it is not blue, press this button to select receive messages.
Finally, create the message.
► Create Receive Message: Click the button to the right of the on Network drop-down box.
Vehicle Spy will create a default Ethernet receive message, like the one in Figure 26.
As with any VSpy message, we can rename the message or change other parameters. Let’s change the default name to something more descriptive.
► Rename Receive Message: Double-click the current message name (“Message Ethernet 1”) and change it to “Decoded Ethernet Message”.
Creating an Ethernet receive message is similar to creating one for CAN, but as you can see in Figure 26, the message itself is quite different. Here are a few things to note about this message:
• In the message list at the top, there are Ethernet-specific columns such as EtherType, Protocol, Source, (Source) Port, Destination and (Destination) Port.
• The setup area currently has two tabs: Ethernet Header and Ethernet Payload.
By default, Vehicle Spy creates a so-called “raw” Ethernet message, which includes only the basic 14-byte Ethernet header and room for arbitrary signals (fields) in the payload section. Let’s take a look at the Ethernet header.
► Select Ethernet Header: Click the Ethernet Header tab in the setup area for our message.
A set of three signals is displayed. If you widen the window you can see the byte positions they occupy, as shown in Figure 27. As you can see, the standard header contains three signals (fields): Destination MAC Address, Source MAC Address and EtherType or Length. The total length of the header is 14 bytes.
This is one of the Ethernet -time-savers built into Vehicle Spy. These fields are always required, so VSpy creates them for you. Note that they can be viewed, but not edited.
Vehicle Spy also sets default values for the standard header fields, which you can see in the message list: the default Source MAC Address is “00:FC:70:00:00:01”, and the default Destination MAC Address is “00:FC:70:00:00:02”. These values can be changed, either here or in the Tx Panel.
The EtherType entry in the message list controls the type of Ethernet message that is defined; you can see that it is currently set to “Raw”. For this example, we actually want to create an IPv4/UDP message, so let’s change the EtherType.
► Change EtherType to IPv4: Double-click on the word “Raw” in the EtherType column, and a drop-down box appears. Select “IPv4”.
The Source and Destination fields change their values to “10.0.0.1” and “10.0.02” respectively. These are default IPv4 address values pre-assigned by Vehicle Spy.
Look in the message details area and you will now see that the tabs have changed: Ethernet Payload has been replaced by two new tabs: IPv4 Header and IPv4 Data.
► Select the IPv4 Header: Click the IPv4 Header tab.
You will now see about a dozen new fields have been defined to meet IPv4 protocol requirements. These ensure that your TCP/IP messages are valid, and are preloaded with default values that normally do not need to be changed.
Finally, let’s set this to be a UDP message carried within an IPv4 message:
► Change Protocol to UDP: Double-click the word “Raw” under the Protocol column and select “UDP”.
Again the message is updated automatically with new headers and defaults. Since UDP uses port numbers, default values (60001 and 60002) have been provided. New UDP Header and UDP Data tabs have replaced the IPv4 Data tab.
► Select the UDP Header: Click the UDP Header tab.
You should now see four signals as shown in Figure 28. Notice how these correspond to the fields we saw when looking at real UDP messages from the Internet (refer to Figure 22).
The process to define custom signals in Ethernet receive messages is the same as that used for traditional networks. The file we will be using in the next section was created as a TCP/IP UDP message with a single 8-bit field used as a sequential counter. Let’s add this signal now to the UDP data area so that we can decode it when we simulate the file.
► Select UDP Data Section: Click the UDP Data tab in the signals area.
A signal with the default name “Signal 22” is created. Let’s rename this.
► Rename Signal: Double-click the signal name “Signal 22” and change it to “Counter”.
Your Vehicle Spy window should now look like Figure 29. Our receive message is ready to use.
Now that we have a receive message defined, let’s simulate the Ethernet data buffer we downloaded earlier, and see how the receive message decodes it.
► Run Simulation on Downloaded Ethernet Data File: Click the down arrow next to the online/offline button, hover the mouse over Run Simulation, select Browse... and navigate to the location where you saved the file you downloaded from the Intrepid website. Then select that file. ► Switch to Messages View: Select Messages View from the Spy Networks menu.
► Select Ethernet Column Set: Change the column set to Ethernet as you did earlier in the guide.
You should now see something similar to Figure 30. The simulated messages are recognized as matching our receive message, Decoded Ethernet Message. Notice in the Details View area, center pane, that the signals/fields have all been decoded, including our custom Counter field. This counter should steadily increase as a new message is played back from the simulation every 500 milliseconds.
► Go Offline.
► Add Signal: Click the button to create a signal.