Skip to content

Latest commit

 

History

History

cia402device

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CiA 402 device

This project is tested open source implementation of CANOpen CiA402 profile (motion control). Axis struct has states, transitions and action flags, its up for application to act on these.

cia402_axis_t cia402axis;                           // create instance of motion control axis
cia402_initialize(&cia402axis, &OD.Status_Word, &mockOD.ALstatus);  // initalize
// ...
while (true) {                                      // in main loop
    // ...                                          // read PDOs from CANbus, EtherCAT...
    cia402_state_machine(&cia402axis, controlword); // process SM

    if (axis.flags.axis_func_enabled) { /* implement your drive following command */ }
    if (axis->flags.hv_power_applied) { /* enable HV power if applicable */ }
    if (axis->flags.brake_applied) { /* release brake if applicable */ }

    if(/* application detected error condition */) {
        cia402axis.state = FAULT_REACTION_ACTIVE;  // trigger fault reaction
        cia402_state_machine(&cia402axis, controlword); // process SM
    }
}

Unit tests can be ran natively on PC (for this one needs to install GCC and add it to PATH)

TODO

How to build PlatformIO based project

  1. Install PlatformIO Core
  2. Download development platform with examples
  3. Extract ZIP archive
  4. Run these commands:
# Change directory to example
$ cd platform-native/examples/hello-world

# Build project
$ pio run

# Execute program
$ pio run --target exec
# or using embedded's "upload" target
$ pio run --target upload

# Clean build files
$ pio run --target clean