4.10. T-Kernel / eT-Kernel

4.10.1. T-Engine T-Kernel

4.10.1.2. System Timer

For T-Kernel the default interval of the system timer interrupt (“time tick”) is 10 ms. The EtherCAT Master Stack needs a system timer interrupt of 1 ms.

Changing the “time tick” interval: The period of the system timer interrupt (“time tick” interval) is defined by the “TTimPeriod” entry of the “SYSCONF” file. It can be changed by the “sysconf” command as follows:

[/SYS]% sysconf TTimPeriod      # check current value
+0: TTimPeriod 10               # timer interrrupt interval (in milliseconds)

[/SYS]% sysconf TTimPeriod 1    # change value to 1 ms
+0: TTimPeriod 1

[/SYS]% exit                    # exit CLI
[IMS]% exit -1                  # system reboot

Please note that the changed value becomes valid after system reboot.

4.10.2. eT-Kernel

The Operating system doesn’t touch anything at the MAC or the Buses while booting. So the initialization has to be done by the linklayer or the user application.

The eTSEC has a flag to specify if the initialization is done by the user application or the linklayer. For the fslFEC the initialization function has to be called before starting the Master application.

4.10.3. Setting up and running EcMasterDemo

  1. Prepare system
    • Install eBinder and all necessary packages like the BSP (Boads Support Package)

    • Connect the JTAG-Debugger to the Board and to you PC and PC via USB to the Board

    • Follow the instruction of the Getting Started Document of the BSP

    • Test both debug connections

  2. Compile EcMasterDemo
    • Create a new project for the Board, with your JTAG Debugger, UART as Debug Port Package, select the packages “LSF Subsystem”, “eSOL make Framework” and “RealtimeProfiler”, and use default configurations

    • Set the SMP configurations in the SYSCONF file as mentioned in the Getting Started Document and define the unchached memory for DMA

    • Configuration->Product Configuration->Parts->eT-Kernel Multi …->T-Kernel , enable the checkbox for “allocate memory for unchached area”,

    • type in the “start address of unchached area” and

    • the for “size of unchached area”

    • in the SYSCONF file set the ReaLMemEnd parameter to the start address.

    • Run the script Script->eT-Kernel Multi-Core Edition-> Build eT-Kernel libraries

    • right click on DEBUG and choose build

    • right click on “all” and click on Add->Build Reference->Files… , Choose the EcMasterDemo.bld file at Workspace->eT-Kernel->EcMasterDemo

    • restart eBinder to ensure everything is saved

  3. Adjust ENI and set Parameters
    • Demo Parameters are located in EcMasterDemo.h

    #elif (defined EC_VERSION_ETKERNEL)
    :
    :
    #define DEMO_PARAMETERS             "-b 2000 -fsletsec 1 1 -v 3 -t 30000" // or -fslfec
    #else
    
    • Create ENI file for EtherCAT configuration.

    • Convert eni file to the C file with array. You can use xxd.exe (Juergen Weigert) with parameters: xxd.exe -i eni.xml ENI.c or some other tool which converts binary file to the C array. Replace ENI.c file with the generated one. File should be manually modified to look like:

    unsigned char MasterENI_xml_data[] = {
    ...
    };
    unsigned int MasterENI_xml_data_size = ???;
    
  4. Start EcMasterDemo
    • Script -> Program Loading Shell Scripts -> Load Resident Unit

    • the new Window click on the GO button, open the VTTY tab and right click on it and set to active

    • right click on EcMasterDemo.a choose “load” (this will take a while)

    • for the execution you have two choices

  5. For Debugging
    • Open “Contexts”

    • Create … (a Task) With the function EcMasterDemo() and a stacksize of 0x4000

    • The Attache the Task

    • In the new window you can step through the code

  6. for simple Execution
    • type “EcMasterDemoMain();” in the shell

  7. Handle lost log prints:
    • the VTTY assigns the prints to the printing task and if the logging task is not attached (has its debug window open) the prints can get lost

    • to prevent this we can turn the Logging Task off (with the define EXCLUDE_LOGGING_TASK) so the prints are saved (it’s limited) and printed in the end in the main window.

4.10.4. OS Compiler settings

Besides the general settings from Compiling the EcMasterDemo the following settings are necessary to build the example application for eTKernel.

Extra include paths
<InstallPath>/SDK/INC/T-Kernel
<InstallPath>/Examples/Common/T-Kernel
Extra source paths
<InstallPath>/Examples/Common/T-Kernel
<InstallPath>/Sources/OsLayer/T-Kernel
Extra library paths to the main EtherCAT components
<InstallPath>/SDK/LIB/T-Kernel