From OpenMBD
Jump to: navigation, search

HANtune supports various ways of communicating. With regards to hardware support there are three options: Ethernet, USB and CAN. Ethernet and USB/UART can only be used in combination with the XCP (universal Calibration Protocol). The CAN-bus can be used either with or without XCP functionalities. This chapter provides more information about the (combination of) these options, as well as the general communication settings in HANtune.

Communication Settings

Communication Settings

Image 11: Communication Settings Dialog shows a screenshot of the communication settings in HANtune. It can be found under the menu item “Communication” > “Communication Settings” and in the connection dialog by clicking the button “Settings”.

In the tab “General” the general communication settings have to be set. A choice has to be made for a communication protocol.

The timeout prescaler is used to define the communication time-out. If HANtune doesn’t receive any messages anymore, by default it cancels the connection after 2*t_prescaler. Please note that this is a temporary solution. It is planned that in a future version of HANtune the behavior of the timeout prescaler will be depending on the expected delay time of incoming messages. The other tabs contain hardware-specific settings for CAN, Ethernet and USB, respectively.


To use the CAN functionality of HANtune, a CAN-dongle is needed. HANtune contains drivers for the PCAN-USB dongle. More info about the USB to CAN dongle can be found on this website:

The XCP on CAN protocol uses two CAN-ID’s, one for sending XCP messages and one for receiving them. By default HANtune uses 665 for transmission and 666 for reception. Additionally the baud-rate needs to be set in order to be able to establish a connection with the target.

If there is a DBC file available in HANtune, the XCP on CAN option also provides the option to include generic CAN messages (not part of the XCP traffic).


Please note that these default settings match the default settings of the HANcoder blockset.

For help, please refer to chapter Troubleshooting.

XCP on Ethernet

To use XCP on Ethernet, a connection should be established between the PC and the target. While the options are not limited to a direct UTP connection between PC and target, this manual only covers the direct wired link.

Additional information about other connection options can be requested by sending an email to:

HANcoder-built targets have a default IP address similar to the one in HANtune: Please make sure that any wireless networks are set inactive when plugging in the Ethernet cable. The communication driver should be set to “XCP on Ethernet” in the tab “General”. Also the IP address should be set to the right address. Then a connection can be established.

Please note that these default settings match the default settings of the HANcoder blockset.

For help, please refer to chapter Troubleshooting.


Virtual COM port

While HANtune is capable of communicating via any COM-Port, the scope of this chapter is limited to the use of a HANcoder-built target.

When using targets built with the HANcoder blockset, HANtune depends on a virtual COM port to be able to communicate with the target. It is provided with the HANcoder blockset, which can be downloaded here. While most PC’s don’t support a physical UART connection anymore, UART to USB converters are freely available. The Olimex boards supported by HANcoder even have the hardware on board, eliminating the use of converters.

When the virtual com port device driver has been installed, Windows automatically assigns a com port to the plugged-in device. To find the assigned COM-port, go to the windows Start menu, type “Device Manager” (Dutch: “Apparaatbeheer”), and press enter. The device manager pops up. Under “Ports (COM & LPT)” a device should be visible with the name “STMicroelectronics Virtual COM Port (COMx)”. Remember the assigned COM-Port.

Go to the “Communication Settings” dialog, select the “XCP on USB/UART” options in the tab “General”. Now go to the tab “USB/UART” and set the right COM-Port. HANtune is now set to connect to the target.

Please note that these default settings match the default settings of the HANcoder blockset.


HANtune can also be used without the use of the XCP protocol. When a DBC file is available, it can be loaded via the “Project Data” side tab. When loaded, the CAN messages and signals which are contained by the DBC file will become visible in the CAN Elements side tab, ready to be used in editors and viewers.

To connect using only CAN, the “CAN” option should be chosen in the Communication Settings, under the tab “General”. Furthermore the baud rate should be set to match the bus’s baud rate. The XCP on CAN settings can be neglected, as they aren’t used.

The viewers will be updated upon receiving a new value. The editors will only send a value upon user input. This means that a time-triggered mode is (as of today) not available in HANtune.

Connection Dialog

Connection Dialog

A connection can be established by pressing the hot-key F5, by clicking the menu item “Communication” > “Connect” or clicking the connect button at the lower left side of HANtune (with the text “Connected: off”). This will cause the connection dialog to pop up. (see Image 13: Connection Dialog)

Two types of connection are available when connecting via the XCP protocol: Request Parameters and Calibrate Parameters. This is what they do:

Request Parameters

During the establishment of the connection, HANtune will request the values of all parameters from the target to display them in the editors. No parameter will be changed on the target-side during the connection procedure.

Calibrate Parameters This type of connection will first connect to the target and immediately thereafter sends the currently active values of the editors to the target to calibrate. It will overwrite the target’s current parameter values.

The option for error monitoring will be further explained in Error Monitoring.