6 - Creating and Transmitting Ethernet Messages
Last updated
Last updated
Copyright © 2024 | All Rights Reserved
Now that we’ve seen how to create and work with Ethernet receive messages, let’s try our hand at transmit messages. These can be used for a variety of purposes, such as communicating with an Automotive Ethernet ECU, simulating the behavior of a network, or diagnosing a network problem.
In this chapter we’ll create a sample Ethernet transmit message and then transmit it both manually and automatically.
We saw in Chapter 5 that creating Ethernet receive messages is pretty much the same as creating CAN receive messages, with the differences being mainly with respect to the structure and contents of the messages themselves. The same is basically true of transmit messages as well.
Once again we’ll begin by resetting Vehicle Spy to a clean slate, and then head over to the Messages Editor.
► Reset Vehicle Spy: Select New from the File menu.
► Open Messages Editor: Select Messages Editor from the Spy Networks menu. And again let’s switch to work with 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. Since we start by default on the “receive side” of the Messages Editor, we will switch to the “transmit side”.
► Switch to Transmit Messages: Click the button, which will change to have blue highlighting. And now we can create our message.
► Create Transmit Message: Click the button to the right of the on Network drop-down box. Vehicle Spy will create a default Ethernet transmit message, which actually will look very similar to the receive message we created earlier (see Figure 26). As before, we can rename the message easily if we wish.
► Rename Transmit Message: Double-click the default message name “Tx Message Ethernet 1” and change the name to “Transmit Test Message”.
As with the receive message, there are Ethernet Header and Ethernet Payload tabs in the setup area. We can likewise change the message type by editing the EtherType field in the message summary if we wish, but for this exercise, we are going to stick with a raw Ethernet message.
Defining signals in transmit messages is done in the same way that we saw for receive messages in Section 5.3. Let’s create a 16-bit field this time. Since this is a raw Ethernet message, the signal will be placed into the Ethernet Payload area.
► Select Ethernet Payload: Click the Ethernet Payload tab in the signals area.
► Add Signal: Click the down-arrow next to the button and select Add 16 Bit Signal.
Vehicle Spy creates a signal spanning bytes 15 and 16 of the message (recall that the Ethernet header takes up 14 bytes). Let’s change the default name.
► Rename Signal: Double-click the signal name “Signal 3” and change it to “Random Data”.
Your Vehicle Spy window should now appear similar to that seen in Figure 31.
Since we are working with a transmit message, we will want to define the values we wish to transmit when we go online. To do this, we will use the Tx Panel.
► Switch to Tx Panel: Select Tx Panel from the Spy Networks menu.
► Move Divider Bar: Slide the vertical divider bar left so the signals area is easier to see.
► Select Transmit Message: Click on Transmit Test Message in the message list on the left side.
You should now see the four signals in the transmit message on the right. As we’ve already seen, the Ethernet header fields are preloaded with default values; these can be changed here if desired, but we will leave them alone. The fourth signal/field, Random Data, is the custom one we defined. Its Value field is blank because we have not yet defined a value for it.
We could simply enter a numeric value into this field. But to make this exercise a bit more interesting, let’s make use of Vehicle Spy’s ability to fill in signals with calculated values.
► Edit Value Field for Random Data Signal: Double-click the cell under Value for the Random Data signal.
► Select Random Data Equation: Click the down-arrow and choose Equation....
A calculated signal dialog box appears. It is already set to Random Data by default, so we only need to specify the Min and Max values for the data. This is a 16-bit signal, so we’ll allow the value to be anything in a 16-bit range.
► Set Min and Max Values: Enter “0” for the Min value and “65535” for the Max value. Vehicle Spy will show you a preview of what the signal will look like with random data; an example can be found in Figure 32. Let’s accept these changes.
Our transmit message is now ready, and will send a random value in its payload each time it is transmitted.
Let’s start by manually transmitting our message. We assume here that you are still set to transmit on the same Internet connection you selected in Section 2.2. If for whatever reason you no longer have this interface selected, go back to the Logon Screen now and be sure the radio button is set to the right Ethernet adapter.
Appropriately enough, transmitting data is done within the Tx Panel. However, it is useful for us to also have the Messages View visible as we do this, so we can see the messages as they are going out. Vehicle Spy has a docking capability that makes this possible, so let’s dock the Tx Panel.
► Dock Tx Panel: Click the Tx Panel tab within Vehicle Spy and drag it until a blue box appears. Continue dragging until the mouse is over the docking icon at the bottom of the window and the blue box fills the lower half of the program. Then release the mouse.
► Reduce the Size of the Tx Panel: Drag the horizontal divider bar that currently separates the Messages Editor from the docked Tx Panel down so the latter takes up less space.
► Switch to Messages View: Select Messages from the Spy Networks menu. Messages View now replaces the Messages Editor.
► Select the Ethernet Column Set.
► Reduce the Size of the Details View Pane: Drag the divider within Messages View to make Details View smaller.
The Tx Panel includes a manual transmit button for each transmit message. We need only click this to send our message.
► Go Online with Transmit: Since in an earlier exercise we were simulating a file, you will need to click the down-arrow and explicitly select Run with Transmit.
Our message should now have been transmitted. However, because of the amount of messages constantly being sent back and forth in a typical PC, it may be hard to find. We can use a filter to make this easier.
► Filter for Our Transmit Message: Enter “transmit” as a column filter under Description.
All of the other messages are hidden and we can now see our message. Your Vehicle Spy screen should look something like Figure 33. Notice the Random Data signal, which in our case has a value of 23298; yours will probably be different.
Sending a message manually is only practical if you need to send it a few times, or you are trying to look for a specific response to a transmission. In many cases what we want is to send the message periodically over time. Fortunately, VSpy makes this easy to do.
Notice in the Tx Panel the word “Periodic” next to the transmit button you pressed, under the Auto Tx column. This means that the message is already set to automatically transmit Vehicle Spy Quick Start Guides Version 1.0 - February 4, 2016 37 © 2016 Intrepid Control Systems, Inc. Using Vehicle Spy with Ethernet periodically. However, we see “None” under the adjacent Rate column, so Vehicle Spy will not actually send the message yet. We need to set an actual period rate, and then it will.
► Set Periodic Transmit Rate: Double-click the word “None” for our transmit message; a drop-down box appears. Select “0.250” and hit Enter.
You will now see a new transmission of our message approximately every 250 milliseconds. This also makes it easy to see that our selection to send random data is working correctly.
If we wish, we can use a signal graph to view our random data transmissions more easily.
► Open Signal Plot Window: Select Signal Plot from the Measurement menu.
Vehicle Spy plots the random data in our signal. You should see a view similar to Figure 34.
► Go Offline.
► Accept Calculated Signal Parameters: Click .
► Transmit Message: Click the button for Transmit Test Message.
► Select Signal to Plot: Click the button near the top of the Signal Plot window.
► Select Random Data Signal: Click Tx Messages in the left menu, expand the Transmit Test Message message if necessary, double-click Random Data and click .