Abstract

 

This guide outlines the process of updating a script from a master to a slave device over a CAN network. The slave device must operate in RoboCAN mode, while the master must be capable of generating the necessary CAN packets to download the script. The master can be a CAN master PC, a PLC, or a Roboteq device operating in RawCAN mode

 

The guide covers all essential steps, including exporting the script to Hex format, re-importing it into the Roborun+ software to generate the file containing the required RoboCAN frames, and creating the high-level script download protocol.

 



Creating the RoboCAN Frames File

 

The Roborun+ utility provides the ability to export a .txt file containing all the required RoboCAN frames that must be sent in sequence to download a script to a RoboCAN device. The exported file also includes an example of the process that the master device should follow.

The steps to create the .txt file are as follows:

 

1. On the Script tab, click the Export Hex option

            A blue rectangle with white text

AI-generated content may be incorrect.

  

2. Save the .hex file

 

3. On the Console tab, select the Update script > Hex to CAN… option

A screen shot of a computer script

AI-generated content may be incorrect.

  

4. Save the .txt file

 


Developing the Application

 

The slave device must operate in RoboCAN mode, and the master device must communicate via the CAN bus, with the capability to construct and transmit custom CAN frames.

 

The Master application Steps are the following: 

 

  1. Wait until the slave's heartbeat is received.
  2. Send the master's heartbeat, activate the emergency stop on the slave, and issue a download request.
  3. If an acknowledgment is received, send the first four script frames.
  4. Continue sending four frames at a time, waiting for acknowledgment after each batch, until the entire script is transmitted.
  5. Send a command to the slave to commit the script and wait for acknowledgment.
  6. Deactivate the emergency stop on the slave.

 

 

The following flowchart illustrates the application procedure executed by the master device:



Sent Frames Example

 

In this example, we will explain the CAN frames that are sent and expected to be received in order to download the following sample script to a slave device:

Incrementer 0

top:

Incrementer++

print("Incrementer = ",Incrementer,"\r")

setcommand(_VAR1Incrementer)

wait(10)

goto top

 

The exported Roborun+ Hex-to-CAN file and the description of the CAN frames are presented below:


Table 1. CAN Firmware Update Example

 

<--------     CAN bus frame    ------->

 

Dir.

Header (Hex)

Number of Payload Bytes

Payload (Hex)

Description

TàS

000

2

T T X X

Check for Heartbeat from slave Node

 

000: Heartbeat Header

T T: Target Node ID (Hex)

X XDon’t Check Byte Value

TßS

000

2

S S 0 0 

Issue heartbeat from source node

 

000: Heartbeat Header

S S: Source Node ID (Hex)

 

TßS

T T 6

4

S S 0E 14 00

Activate emergency stop on target node

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

 

TßS

T T 1

8

SS 02 14 FF CB 10 2C 13

Send download request to target node 

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

 

Table 1. CAN Firmware Update Example (Continued)

 

<--------     CAN bus frame    ------->

 

Dir.

Header (Hex)

Number of Payload Bytes

Payload (Hex)

Description

TàS

SS9

X

T T 02 XX B0 XX XX XX XX

Wait for acknowledge

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

XDon’t Check Message Length

X XDon’t Check Byte Value

TßS

T T 2

8

SS 0F 00 00 01 01 06 01

 

Start sending of records

 

S S: Source Node ID (Hex)

T T: Target Node ID (Hex)

 

TßS

T T 2

8

SS 0F 04 00 05 14 01 06

 

TßS

T T 2

8

SS 0F 08 00 24 0E 49 6E

TßS

T T 2

8

SS 0F 0C 00 63 72 65 6D

TàS

S S 9

X

T T 02 XX C0 XX XX XX XX

 

Wait for acknowledge

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

XDon’t Check Message Length

X XDon’t Check Byte Value

TßS

T T 2

8

SS 0F 10 00 65 6E 74 65

 

 

Sending of records

 

S S: Source Node ID (Hex)

T T: Target Node ID (Hex)

 

TßS

T T 2

8

SS 0F 14 00 72 20 3D 20

TßS

T T 2

8

SS 0F 18 00 01 05 25 24

TßS

T T 2

8

SS 0F 1C 00 01 0D 02 06

TàS

S S 9

X

T T 02 XX C0 XX XX XX XX

 

Wait for acknowledge

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

XDon’t Check Message Length

X XDon’t Check Byte Value

 

 

 

Table 1. CAN Firmware Update Example (Continued)

 

<--------     CAN bus frame    ------->

 

Dir.

Header (Hex)

Number of Payload Bytes

Payload (Hex)

Description

TßS

T T 2

8

SS 0F 20 00 02 01 01 05

 

Start sending of records

 

S S: Source Node ID (Hex)

T T: Target Node ID (Hex)

 

TßS

T T 2

8

SS 0F 24 00 29 02 0A 23

 

TßS

T T 2

8

SS 0F 28 00 03 03 00 20

TßS

T T 2

8

SS 0F 2C 00 00 FF FF FF

TàS

S S 9

X

T T 02 XX C0 XX XX XX XX

 

Wait for acknowledge

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

XDon’t Check Message Length

X XDon’t Check Byte Value

TßS

T T 2

4

SS 0F 2C 00

 

 

Commit Script

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

TàS

S S 9

X

T T 02 XX D0 XX XX XX XX

 

Wait for acknowledge

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

XDon’t Check Message Length

X XDon’t Check Byte Value

TßS

T T 6

4

S S 0F 14 00

Deactivate emergency stop on target node

 

T T: Target Node ID (Hex)

S S: Source Node ID (Hex)

 

 

 

 Download the Application Note at the end of the article.