ZHCU563B March 2015 – December 2018
To test the single-chip motor-control application, use TwinCAT or another compatible EtherCAT master with CiA402 Drive profile support.
Additional details on TwinCAT configuration can be found at Configuring TwinCAT For TI EtherCAT Slave.
To use TI slave with TwinCAT, do the following:
NOTE
TI recommends to using a NIC-compatible card listed at Supported Network Controller by Beckhoff Ethernet Driver. Check that the ethernet adapter is listed under Installed and ready to use devices before run running the TwinCAT demonstration.
NOTE
TI Box n (ti-esc) is automatically detected.
Device | NC Axis |
---|---|
Box1 → Module 1→ Inputs → Status Word | Axis 1 → Drive → In → nState1 + nState2 |
Box1 → Module 1→ Inputs → ActualPosition | Axis 1 → Enc → In → nDataIn1 |
Box1 → Module 1→ Outputs → Control Word | Axis 1 → Drive → Out → nCtrl1 + nCtrl2 |
Box1 → Module 1→ Outputs → TargetPosition (required only in csp mode) | Axis 1 → Drive → Out → nDataOut1 |
Box1 → Module 1→ Outputs → TargetVelocity (required only in csv mode) | Axis 1 → Drive → Out → nDataOut2 |
For the Status Word and Control Word, continuous process data mapping is required. This can be performed in the linking window (for example, the Status Word link window in Figure 9). Enable “All Types”, “Continuous” and select the desired variables. TwinCAT maps “nState1” to the low byte and “nState2” to the high byte of the Status Word.
The formula to calculate the Scaling Factor is enc.scaling = (mm/rev)/encoder resolution. In this application, the encoder resolution is set to 2^20 = 1048576. Taking 360 mm per rev. The scaling factor is calculated as (360/1048576) = 0.000343323.
(Only required for csv mode) Update the Output Velocity Scaling Factor : Axis 1 → Drive → Parameter Tab → Position and Velocity Scaling → Set value of "Output Scaling Factor (Velocity)" to "7500.007152564"
The formula to calculate the Output Velocity Scaling Factor is velo.scaling = (2^20 / encoder resolution) * (velo resolution / 139.81). In this application, the encoder and velocity resolution are both set to 2^20 - 1048576. Therefore, the scaling factor is calculated as (2^20/2^20) * (2^20/139.81) = 7500.007152564. The encoder and velocity resolution are set as macros in the the patched cia402appl.c.
#define TWINCAT_SINGLE_TURN_RES pow(2, 20)
#define TWINCAT_VELOCITY_RES pow(2, 20)
Updating these values will also require updating the scaling factors accordingly.
The formula to calculated the scaling factor is described in the EtherCAT Slave Stack Code Application Note ET9300
For csp → ModeOfOperation = 8
For csv → ModeOfOperation = 9
Refer to the ETG 6010 CiA402 Implementation Directive for details on the ModeOfOperation variable values.