Skip to content

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xeryon CANopen Example

This repository provides examples for working with CiA 402-compliant devices from Xeryon over CANopen. The repository includes installation instructions, communication setup, and Python programming examples for motion control.

1. Table of Contents

2. Wiring

⚠️ Safety Warning: Always disconnect power before wiring. Incorrect wiring while powered can damage the device.

Before proceeding, please refer to the wiring diagram for the correct setup. The wiring involves connecting the breakout board, STO, and power supply to the motor and CAN adapter.

We use the Fysetc UCAN USB-to-CAN adapter. However, you are free to use any compatible USB-to-CAN device.

2.1. Wiring Steps

  1. Power Off - Ensure the breakout PCB is not powered, and the power plug is disconnected.
  2. Connect FFC to XLA - Attach the FFC cable to the XLA. (Wiring example)
  3. Connect FFC to Breakout Board - Attach the other end of the FFC cable to the breakout board.
  4. Connect STO - Connect the STO (Safe Torque Off) pin to the 3.3 V pin on the breakout board.
  5. Connect CAN Bus - Connect the CAN_H, CAN_L, and GND terminals of the USB-to-CAN adapter to the corresponding pins on the breakout PCB.
  6. Connect USB - Plug the USB-C cable between the USB-to-CAN adapter and your PC.
  7. Connect Power Cables - Attach the power cables to the screw terminals.
  8. Verify Connections - Double-check that all connections are secure and correctly placed.
  9. Power On - Connect the power plug and switch on the power supply.

Note: No LEDs will be on when the device is powered

Wiring Diagram

3. Software Installation

3.1. Requirements

3.2. Install dependencies

You can install the required dependencies by running the following command.

pip install -r requirements.txt

3.3. Open the examples directory

Make sure you are in the examples directory before running the following commands:

cd examples

3.4. Interface Compatibility

Ensure your hardware (e.g., USB-to-CAN adapter) is connected and supported by your system:

  • For Linux socketcan: ensure kernel CAN drivers are loaded

3.5. Change settings.py

To configure the CAN interface and channel for your platform, open settings.py and update the following values:

# Encoder resolution
ENC_RES = EncoderRes.ENC_RES_1MU

# Default Node ID is 32
NODE_ID = 32

# Interface (str): Interface type (e.g., "slcan", "socketcan").
CAN_INTERFACE = "slcan"

# Channel (str): CAN channel (e.g., "COM3", "/dev/ttyACM0", "can0").
CAN_CHANNEL = "COM3"

# Default bitrate is 125Kbps
CAN_BITRATE = CANBitrate.BITRATE_125k

# Filename of the EDS file
EDS_PATH = "../eds/xeryon_xla_5_eds.eds"

4. Quick Start

Ensure you have updated settings.py with your CAN interface details first.
To quickly verify the communication of your setup, run:

python tests/verify_communication.py

To configure the device and save the parameters, run:

python configuration.py

This will configure all the configuration settings to the (default) values. An error will occur when there is a communication issue.

You can also run other examples:

python <filename>.py

5. Documentation

These are detailed guides on how to configure, home, and perform motion with the motor:

Guide Type Description
CANopen documentation CANopen introduction manual
Configuration How to set parameters and save them
Homing How to execute a homing operation
Profile Position mode How to use profile position mode
Daisy Chaining How to use daisy chaining
Wiring example Wiring example
EDS EDS file information
FAQ Frequently asked questions

6. Project Structure

.
├── docs/
│   ├── configuration.md              # Guide for configuration                             
│   ├── daisy_chaining.md             # Guide for daisy chaining
│   ├── eds.md                        # Information about EDS
│   ├── homing.md                     # Guide for homing
│   ├── mode_profile_position.md      # Guide for mode profile position
│   └── wiring.md                     # Wiring example
│   
├── eds/
│   ├── xeryon_xla_5_eds.eds          # EDS file
│   └── xeryon_xla_5_eds_docu.txt     # Documentation of EDS fields
│   
├── examples/                         # Code Examples
│   ├── common/
│   │   ├── parameters.py             # Hardcoded parameters, values and enums
│   │   └── utils.py                  # Shared functions
│   │
│   ├── daisy_chaining_configuration/
│   │   ├── change_node_id_all.py     # Example to automatically reassign all Node IDs
│   │   └── change_node_id_single.py  # Example to change Node ID of specific node
│   │
│   ├── tests/
│   │   └── verify_communication.py   # Script to verify the communication of a node
│   │
│   ├── configuration.py              # Example script for configuration
│   ├── homing.py                     # Example script for homing
│   └── mode_profile_position.py      # Example script for mode profile position
│
├── FAQ.md                            # Frequently asked questions
├── README.md                         # General Guide for running the examples
└── requirements.txt                  # Dependency file for python setup

7. FAQ & Support

Please refer to the FAQ for a complete list of common questions and answers.

If you need further assistance with this software or any Xeryon product, please contact our support team: support@xeryon.com

8. Disclaimer

The software and accompanying documentation are provided "as is" and without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall Xeryon be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or its use.

About

Programming examples for XLA Integrated Controller

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors