C5-E CANopen/USB Technical Manual

Configuration via USB

General

The following options are available for configuring the controller via USB:

Configuration file
This file can be saved to the controller via the USB connection. For further information, read chapters USB connection and Configuration file.
NanoJ program
This program can be programmed, compiled and then transferred to the controller with NanoJ via USB. For further information, read chapters NanoJ program and Programming with NanoJ.
After connecting to a voltage supply, the controller reads out the configuration in the following order:
  1. The configuration file is read out and processed.
  2. The NanoJ program is started.

USB connection

If the controller is connected to a PC via a USB cable, the controller behaves like a removable storage device. No further drivers are required.

You can thereby store the configuration file or the NanoJ program on the controller. The voltage supply of the controller must also be connected during USB operation.

Note:
  • Only use a standard Micro USB cable. Never use a USB cable that manufacturers of mobile phones include with their products. These USB cables could have a different plug shape or pin assignment.
  • Do not save any files on the controller other than those listed below:
    1. cfg.txt
    2. vmmcode.usr
    3. info.bin
    4. reset.txt
    5. firmware.bin
    Any other file is deleted when the voltage supply of the controller is switched on!
Tip:

Because it is often necessary during commissioning to copy the same file to the controller following an update, it is recommended that a script file be used to perform this task.

  • Under Windows, you can create a text file with file extension bat and the following content:
    copy <SOURCE> <TARGET>
  • Under Linux, you can create a script with file extension sh and the following content:
    #!/bin/bash
    cp <SOURCE> <TARGET>

Configuration file

General

The cfg.txt configuration file is used to preset values for the object dictionary to a certain value during startup. This file uses a special syntax to make accessing the objects of the object dictionary as easy as possible. The controller evaluates all assignments in the file from top to bottom.

Note: If you delete the configuration file, the controller recreates the file (without content) on the next restart.

Reading and writing the file

How to access the file:

  1. Connect and switch on the voltage supply.
  2. Connect the controller to your PC using the USB cable.
  3. After the PC has detected the device as a removable storage device, navigate in the Explorer to the directory of the controller. File cfg.txt (for a PD4C, the file is named pd4ccfg.txt) is stored there.
  4. Open this file with a simple text editor, such as Notepad or Vi. Do not use any programs that use markup (LibreOffice or similar).

After you have made changes to the file, proceed as follows to apply the changes:

  1. Save the file if you have not yet already done so.
  2. Disconnect the USB cable from the controller.
  3. Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
  4. Reconnect the voltage supply. When the controller is now restarted, the values in the configuration file are read out and applied.
Tip:

To restart the controller, you can also copy an empty reset.txt file to the controller. This restarts the controller. The reset.txt file is deleted on the next restart.

Structure of the configuration file

Comments

Lines that begin with a semicolon are ignored by the controller.

Example

 
; This is a comment line

Assignments

Note: Before setting a value, determine its data type (see chapter Description of the object dictionary)! The controller does not validate entries for logical errors!
Values in the object dictionary can be set with the following syntax:
<Index>:<Subindex>=<Value>
<Index>
This value corresponds to the index of the object and is interpreted as a hexadecimal number. The value must always be specified with four digits.
<Subindex>
This value corresponds to the subindex of the object and is interpreted as a hexadecimal number. The value must always be specified with two digits.
<Value>
The value that is to be written in the object is interpreted as a hexadecimal number. Hexadecimal numbers are to be prefixed with "0x".

Example

 
Set object 2031h:00 (rated current) to the value "600" (mA):
2031:00=600
 
Set object 3202h:00 to the value "8" (activate current reduction while at a standstill in open loop mode):
3202:00=8
 

Set object 2057h:00 to the value "512" and object 2058h to the value "4" (quarter step step mode in clock-direction mode):

2057:00=512
2058:00=4
Note:
  • There must be no blank characters to the left and right of the equal sign. The following assignments are not correct:

    6040:00 =5

    6040:00= 5

    6040:00 = 5

  • The number of places must not be changed. The index must be four characters long and the subindex two characters long. The following assignments are not correct:

    6040:0=6

    6040=6

  • Blank spaces at the start of the line are not permitted.

NanoJ program

A NanoJ program can be executed on the controller. To load and start a program on the controller, proceed as follows:

  1. Write and compile your program as described in chapter Programming with NanoJ.
  2. Connect the voltage supply to the controller and switch on the voltage supply.
  3. Connect the controller to your PC using the USB cable.
  4. After the PC has detected the device as a removable storage device, open an Explorer window and delete file vmmcode.usr on the controller.
  5. Navigate in the Explorer to the directory with your program. The compiled file has the same name as the source code file, only with file extension .usr. Rename this file vmmcode.usr.
  6. Copy file vmmcode.usr to the controller.
  7. Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
  8. Reconnect the voltage supply. When the controller now starts, the new NanoJ program is read in and started.
Tip:

To restart the controller, you can also copy an empty reset.txt file to the controller. This restarts the controller. The reset.txt file is deleted on the next restart.

Note:
  • The NanoJ program on the controller must have file name vmmcode.usr.
  • If the NanoJ program was deleted, an empty file named vmmcode.usr is created the next time the controller is started.
Tip:

It is possible to automate the deletion of the old NanoJ program and the copying of the new one with a script file:

  • Under Windows, you can create a file with file extension bat and the following content:
    copy <SOURCE_PATH>\<OUTPUT>.usr <TARGET>:\vmmcode.usr
    For example:
    copy c:\test\main.usr n:\vmmcode.usr
  • Under Linux, you can create a script with file extension sh and the following content:
    #!/bin/bash
    cp <SOURCE_PATH>/<OUTPUT>.usr <TARGET_PATH>/vmmcode.usr
▶   next

Contents