Skip to content

This repository is used for study and test a CANOpen protocol by using Christiansandberg's CANOpen-python for THOpenSCADA project.

Notifications You must be signed in to change notification settings

noahcroit/CANopen-python

Repository files navigation

CANOpen-python testing for THOpenSCADA project

This repository is used for study and test a CANOpen protocol by using Christiansandberg's CANOpen-python for THOpenSCADA project. Link of christian's CANOpen : http://canopen.readthedocs.io/

To be able to understand CANOpen protocol. The list of main functionality in CANOpen has been tested.

  • NMT (Network Management)
  • SDO (Service Data Object)
  • PDO (Process Data Object)
  • Sync
  • Heartbeat
  • Emergency
  • etc.

Test CANOpen hardward

Repository contains a folder of each tested CANopen devices which are commonly used in the industry. Here is the list of tested devices.

  • Beckhoff LC5100 Remote I/O
  • ... (In the future)

CANOpen Interface device for testing

Requirement

  1. CANOpen for Python
pip install canopen

Or install with requirement.txt in this repository for all dependency modules

pip install -r requirement_canopen.text
  1. Driver for CAN Interface which depended on the hardware you have. The list of supported CAN interface are shown in this page https://python-can.readthedocs.io/en/stable/interfaces.html

How to run the demo

For Bewckhoff LC5100 Remote I/O

  1. Install CAN interface's driver
    For Korlan's USB2CAN
Windows

Install driver and use USB2CAN test application (Get from the driver installation) to test and see serial number of USB-to-CAN interface. This serial number will be used in can-python.

Linux

Install driver from this repository : https://github.com/8devices/usb2can
Tools : Use can-util to test CAN interface.

sudo apt-get install can-utils

Before using USB-to-CAN interface device with can-python, run this command to open 'SocketCAN' for USB2CAN interface

sudo ip link set can0 up

For a specific bitrate and sample-point

sudo ip link set can0 up type can bitrate 125000 sample-point 0.875
  1. Run test_canopen_lc5100.py to test CANOpen functionality.
Example

(test NMT, OS=Linux)

python test_canopen_lc5100.py --os linux --nmt


(test PDO, OS=Windows)

python test_canopen_lc5100.py --os win --pdo

About

This repository is used for study and test a CANOpen protocol by using Christiansandberg's CANOpen-python for THOpenSCADA project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages