Build EtherCAT Communications & Control Between NI PXI/cRIO with Nidec Unidrive Motor Drive

Updated May 8, 2024

Environment

Hardware

  • PXIe-8135
  • cRIO-9038

Software

  • LabVIEW
  • LabVIEW Real-Time Module

Driver

  • NI-Industrial Communications for EtherCAT

For Kollmorgan and other NI supported third party brand motor drives, we can use NI LabVIEW Softmotion Module and SDI Plug-ins from the LabVIEW Tools Network to call some integrated APIs or Express VIs to develop our control and communication code.
Refer to:
But how to do this with a Moter/Driver Vendor which NI has not closely worked with and unsupported by higher level APIs and Modules? In this Case, we use Nidec Unidrive M700 as example.

Note: The How-To steps are almost similar for PXI & CRIO platform, so this article just use PXI as example.

1. Create LabVIEW project and add Real-Time PXI controller in the network.
Picture1.png

2. Make sure the NI-Industrial Communications for EtherCAT driver has been well installed in PXI RT controller.
Picture2.png

3. In NI Max, configure the PXI controller Ethernet Adapter eth1 as "EtherCAT" Adapter mode. If you cannot find EtherCAT selection, you need to check your drivers and software environment.
Picture3.png
Picture4.jpg

4. Add your PXI EtherCAT interface resource into your project.(In this case, Intel 82574L)
Picture5.png

5. Import Nidec Unidrive M700 XML file (Provided by Drive Vendor, need to align with drive/EtherCAT comms module's firmware, confirm with your drive vendor) into NI LabVIEW.
Picture6.png
Note: Do not rename the xml file, this may cause unknown error.
Picture7.png

After successful import, LabVIEW now can detect the existed EtherCAT slave device connected to PXI controller and will automatically imported opened IO for later operation.
Picture8.png
If you would like to revise opened IO in LabVIEW, you need to revise XML file, please ask Drive Vendor's expert to do this, otherwise not recommended to do this, refer to Change PDO Mappings for a Third Party EtherCAT XML File

6. To Look up for the Online state and parameters of the EtherCAT slave device(the Drive), right click the Slave device in LabVIEW project and select "Online Slave Device State".
Picture9.png
Picture10.png
Under normal communication, the green light of the Ethernet network port will continue to blink, if it is steady green on it is successful connected but not established data communication.
Picture11.jpg

7. Configure the EtherCAT slave device Distributed Clock to be same with NI Scan Engine period, in this case, 1ms is Scan Engine's period. Enable Distributed Clock and set Shift Time as half of the Scan period.
Picture12.png
Picture13.png

8. Configure some Initial commands data for the slave device, to make sure it works as expected in pre-operational states. In this case, need to configure 0x60C2, subindex 0x1 as 01, 0x2 as FD. Different hardware has different configuration requirements, ask your drive vendor for specific information.
Picture14.png

9. Before running your VI code, switch the Scan Engine from configuration mode to Active mode and check the Operational state has entered in the EtherCAT slave Status.
Picture15.png

10. Run your LabVIEW RT vi, develop code based on opened IO of the drive. (attached code as reference)
Picture16.png

11. "Control word" send 0110B, 0111B, 1111b in sequence to start the drive, the drive panel will display "Run";
Picture17.jpg

12. Modify the value of "Target Position". It can be found that in Position mode, the motor shaft rotates as the value changes.

13. Refer to the EtherCAT communication documentation from the drive vendor to check the meaning of "Status Word" IO return values, which correspond to the current Status of the drive.

14. "Position Actual Value" comes from the return Value of the motor encoder. There will be different return Value when the Position of the shaft changes.
Picture18.png
 

Attachments