CANopenDemo
CANopenNode demo, tutorial and testing
|
Tests on Running CANopen network are implemented with two CANopenNode devices, running on CAN interface. Example runs with CANopen devices as specified in tutorial/README.md. First is canopend
, CANopenLinux device with gateway interface, second is demoDevice
. cocomm
program from CANopenLinux is used for communication with CANopenLinux gateway device.
Tests are run in Linux command line with Bash Automated Testing System - BATS, which is included in CANopenDemo as three git submodules.
Test results are available in test_report.md.
cocomm
, canopend
and demoDevice
as described in tutorial/README.md. canopend
with NodeId=1 must run in Linux, demoDevice
with NodeId=4 must run on any platform, can0
is the default CAN interface in Linux.See file config_bats.sh
for configuration options. To change the default values, type the following before running the tests:
export test_can_device=<customCanDevice>
(default export test_can_device=can0
)canopend
): export D1=<nodeID>; export B1=<80+nodeID>;
(default export D1=01; export B1=81
- hex value)demoDevice
): export D2=<nodeID>; export B2=<80+nodeID>;
(default export D2=04; export B2=84
- hex value)Run individual tests from the terminal:
running_canopen/basic_NMT_SDO_heartbeat.bats running_canopen/heartbeat_consumer.bats running_canopen/SDO_transfer.bats
Run all tests:
./test_all.sh
Open the *.bats
script file in text editor and examine the contents. Script is quite straightforward, see BATS usage and BATS assert for information on testing commands. Command line program cocomm is used for running each test. Testing program uses one additional functionality of cocomm
- it prints dump of actual CAN messages, which occur with each cocomm
command. So BATS can verify the complete result.
CANopen Conformance Test Tool, version 3.0.3.10, running on Windows PC with CAN interface
Device under test is demoDevice
with with some additional settings, device dependent:
CO_errorReport(CO->em, CO_EM_NON_VOLATILE_MEMORY
(file CO_main_PIC32.c)CO_NMT_STARTUP_TO_OPERATIONAL
(file CO_main_PIC32.c)CO_CONFIG_EM_PROD_CONFIGURABLE
to CO_CONFIG_EM
(re-define macro CO_CONFIG_EM
in CO_driver_custom.h file)Complete test result are available in test_report_CCT.md. Note that sequence of CAN messages may not be always correct. Note also, test "OD 10" takes very long time. Test succeed, but data is skipped from report.