Skip to content

TwinCAT Setup

Introduction

  • This document guides you how to setting up a TwinCAT project to control Neuromeka CORE module. In order to follow these instructions. You need a PC or Laptop which runs Windows 7 or later version and has an Ethernet port.
  • Connection between PC/Laptop with CORE Module is described below:

    Figure1 Figure 1. CORE Module - EtherCAT Connection

Preparation for TwinCAT3

Requirements

  1. Microsoft Visual Studio 2010 (with Service Pack 1), 2012, 2013, 2015 or 2017 Professional, Premium or Ultimate–When installing Visual Studio 2015, the Visual C++ development option must be manually selected, as this option is not selected with the automatic installation.

    Figure2 Figure 2. Enable Visual C++ Development Option

  2. Microsoft Windows Driver Kit 7 (WDK): Installing Windows Driver Kit

  3. TwinCAT 3 installation (XAE engineering)

Notice:

  1. TwinCAT (TC) 3.0 only supports 32-bit operating systems as target platform (runtime PC).

    • TC 3.0 can be used as engineering platform on x64 PCs for project development.
    • The program can be transferred to a 32-bit (x86) remote PC over the network for execution.
  2. TC 3.1 supports x64-bit operating systems as target platform (runtime PC). However, the drivers need to be signed, as documented here, which requires a certificate for operation.

  3. The target runtime must be based on “Windows NT Kernel”

    • E.g. Windows XP, Windows 7, Windows XP Embedded, Windows Embedded Standard 2009, Windows Embedded Standard 7, etc.

x64: driver signing

  1. Open Windows Command Prompt with administrator rights
    • Start ⇨ Command Prompt then right-click on “Run as administrator”
  2. In Command Prompt, go to directory ***%WINDDK7%\bin\x86\ ***
  3. Execute command: makecert -r -pe -ss PrivateCertStore -n CN=MyTestSigningCertMyTestSigningCert.cer
    • This is followed by creation of a self-signed certificate, which is stored in the file "MyTestSigningCert.cer" and in the Windows Certificate Store
    • The result can be verified with mmc (Use FileAdd/Remove Snap-inCertificates)

      Figure3 Figure 3. Verify x64 Driver Certificate

  4. Set the system environment variable "TWINCATTESTCERTIFICATE" to "MyTestSigningCert
  5. Activate signing mode, so that Windows can accept the self-signed certificates.
    • In Command Prompt, execute: bcdedit /set testsigning yes and restart Windows (SecureBoot must be disabled in Bios before executing command)
  6. If test signing mode is enabled, this is displayed at the bottom right of the desktop. The PC now accepts all signed drivers for execution.

    Figure4 Figure 4. Activate Certificate in Windows Test Mode.png

Add Ethercat XML Device Description (ESI) file for CORE module

  1. Copy CORE module description file into TwinCAT directory (used when scanning for IO devices)
    • Description file: NRMK Drive.xml
    • Location: < TwinCAT installation path >\3.1\Config\Io\EtherCAT

      Figure5 Figure 5. TwinCAT Location to ESI Files

Setting tips

Assign CPU Core for TwinCAT

  1. To avoid conflict with other applications (such as VMWare), TwinCAT should run on isolated CPU.
  2. Your CPU must have at least 2 cores for doing this step.
  3. Setting is below:
    • In Solution Explorer, click SYSTEM > Real-time
    • Click “Read from Target” to list all available CPU cores
    • Then click “Set on Target” and set number of cores you want to use for Windows
    • The remaining cores can be selected for real-time task.
      Figure6
      Figure 6. TwinCAT3 Project - Assign CPU's Cores for Real-time Task

Setup Tick

  1. Required when you run Windows 8 or later version
  2. Open Command Promt in Administrator mode, then run command: %TWINCAT3DIR%\System\win8settick.bat
    Figure7
    Figure 7. TwinCAT3 Project - Setup Real-time Tick

Install TwinCAT driver for Ethernet card

  1. TwinCAT > Show Realtime Ethernet Compatible Devices…
  2. Click Yes to allow “Application TcRteInstall”
  3. At “Ethernet Adapters” windows, click on Ethernet card which is intended to use for Ethercat.
  4. Click Install to setup driver.
  5. Then close the window

    Figure8
    Figure 8. TwinCAT3 - NIC Driver for EtherCAT

    Note: Alternatively, in Solution explorer, you can make a double-click on Device 1 (EtherCAT) under I/O -> Devices Then, in Adapter tap, click on Compatible Devices...

Assign Ethernet card for Ethercat Master

  1. In Solution explorer, double-click on Ethercat master device (such as “Device 1 (EtherCAT)”)
  2. In Adapter tab, click “Search…” and select Ethernet card to use for Ethercat.
    Figure9
    Figure 9. TwinCAT3 - Assign NIC to Ethercat Master

Retargeting solution and project

  1. Retargeting is required when open solution/project with different SDK
  2. Right-click on TwinCAT Solution and select Retarget solution
    Figure10
    Figure 10. TwinCAT3 - Retarget TwinCAT Solution & Project

References