NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

SYSBIOS Industrial SDK 02.01.00.01 User Guide

From Texas Instruments Wiki
Jump to: navigation, search
TIBanner.png
SYSBIOS Industrial SDK 02.01.00.01 User Guide

Revision History

Revision Date Description
1.0 10-Jul-2015 Created initial version of the document





Industrial SDK Introduction[edit]

The SYSBIOS-based software development kit (SDK) for industrial communications is designed for the Sitara AM335x and AM437x ARM microprocessor family(with PRU-ICSS IP). The SDK enables customers add real-time industrial communications, motor control and feedback capabilities easily and quickly to their system. By making all the basic system software components immediately available, the Kit allows developers to focus on their application code, where they can add the most differentiation. The SDK is optimized to support real-time industrial communications protocols such as EtherCAT, Profibus, Profinet, Ethernet/IP and motor feedback functions like EnDat, BISS, Sigma Delta Decimation Filter. The SDK includes a real-time, low-footprint SYSBIOS kernel with boot loader and sample industrial applications to get started quickly.

The SYSBIOS Industrial SDK combines all the software components and tools needed to begin development of SYS/BIOS-based applications on the ARM. The SDK supports AM437x IDK and AM335x ICEv2 hardware platform and includes the following

  • Open source SYS/BIOS Real Time Operating System (RTOS)
  • Bootloader for AM437x IDK and AM335x ICEv2 with support to boot from various peripherals
  • Library of peripheral drivers integrated with SYSBIOS supporting IDK and ICEv2
  • Sample applications demonstrating peripheral use cases for IDK and ICEv2
  • Code Composer Studio integrated development environment (IDE) v.6.1
  • Sample industrial input/output applications over communication protocols such as EtherCAT
  • Motor and Drive feedback capability with support for interfaces like EnDat, Sigma Delta Decimation Filter etc
  • Evaluation versions of protocol stacks for industrial communications such as EtherCAT, EnDat and many others to facilitate software development


The Industrial SDK is supported on AM437x IDK and AM335x ICEv2

A high level block diagram of AM437x IDK is shown below.


Am437x idk functional diag.jpg

Figure 1 AM437x Industrial Development Kit

A high level block diagram of AM335x ICEv2 is shown below.


ICE V2 Block Diagram1.JPG

Figure 2 AM335x Industrial Communication Engine v2


Reference Documents[edit]



SDK Directory Structure[edit]

|--- sdk

|   |--- board

|       |--- include

|           |--- icev2am335x

|           |--- idkam437x

|       |--- lib

|       |--- source

|           |--- drivers

|           |--- icev2am335x

|           |--- idkam437x

|   |--- control

|       |---foc

|       |---math_blocks
 
|   |--- docs

|       |---SYSBIOS Industrial SDK 02.XX.XX.XX User Guide.pdf

|       |---SYSBIOS Industrial SDK Release Notes.pdf

|       |---SYSBIOS Industrial SDK Getting Started Guide.pdf

|   |--- examples

|       |--- endat_diagnostic

|       |--- ethercat_slave

|           | --- esi

|       |--- ethernet_mac

|       |--- ethernetip_adapter

|           | --- stc

|       |--- example_utils

|       |--- motor_control

|       |--- profibus_slave

|           | --- APP

|           | --- GSD

|           | --- include

|       |--- profinet_slave

|           | --- GSD

|           | --- snmp

|       |--- sddf_gui_client

|   |--- interfaces

|       |--- endat_master

|               |--- doc

|               |--- driver_endat

|               |--- firmware

|               |--- include

|       |--- pru_onchip_adc_sampling

|               |--- firmware

|       |--- sddf

|               |--- doc

|               |--- driver_sddf

|               |--- firmware

|               |--- include

|   |--- os_drivers

|       |--- include

|       |--- lib

|       |--- lld

|       |--- source

|   |--- protocols

|       |--- ethercat_slave

|               |--- docs

|               |--- ecat_appl

|                       |--- esi

|                       |--- patch

|                       |--- EcatStack

|               |--- firmware

|               |--- include

|               |--- stack_lib

|       |--- ethernet_mac

|               |--- firmware

|       |--- ethernetip_adapter

|               |--- driver

|               |--- eds

|               |--- firmware

|               |--- include

|               |--- stack_lib

|       |--- profibus_slave

|               |--- doc

|               |--- firmware

|               |--- include

|               |--- stack_lib

|       |--- profibus_slave

|               |--- Docs

|               |--- drivers

|               |--- firmware

|               |--- include

|               |--- stack_lib

|       |--- ptp

|               |--- drivers

|               |--- include

|       |--- snmp

|               |--- drivers

|               |--- include

|               |--- stack_lib

|   |--- starterware

|   |--- tools

|       |--- bin2header

|       |--- gel



board - This folder contains source code for board specific interfaces implementation(Eg: Digital Outputs/Inputs, Flash etc.)

control - This folder contains source code required for Motor control(FOC and IQMATH)

docs - This folder contains the pdf versions of the Release Notes, User Guide and Getting Started guide

examples - This folder contains examples, their project files, source and include files. Users can build the application in CCS using these files. Please see the [Getting Started Guide] for details on building an application

interfaces - This folder contains supported motor control interface source, header and firmware

os_drivers - This folder contains source code and include files for SYS/BIOS driver for AM437x and a pre-built library.

protocols - This folder contains supported industrial automation protocol libraries and/or source codes and their project files.

starterware - This contains StarterWare code which provides Device Abstraction Layer libraries and peripheral/board level sample/demo examples that demonstrate the capabilities of the peripherals on a no_OS platform. See StarterWare

tools - This contains tools supporting application development. For eg GEL files.



System Requirements[edit]

Hardware[edit]

  • AM437x IDK or AM335x ICEv2
  • Windows Host Machine with minimum 2GB RAM
  • Micro SD Card

Software [edit]

  • Code Composer Studio version CCS 6.1.0.00104
  • Industrial SDK version 2.1.0.1
  • SYS/BIOS 6.41.4.54 Real Time Operating System
  • XDC Tool 3.31.2.38_core
  • NDK 2.24.2.31
  • Compiler GNU v4.8.4 (Linaro)
  • Serial console terminal application (like Teraterm, minicom, HyperTerminal)



SDK Setup[edit]

The SDK setup will install following items in the machine.

  • SDK Source files, CCS project files, pre-built libraries and documents

The installation process will use an environment variable called IA_SDK_HOME which will be set to location where the sdk is installed. This variable is used by sdk examples for include and library paths. This should be defined ether as a project or as a CCS user defined variable.

Pre-Built Binaries and Libraries[edit]

The SDK installation comes with following pre-built libraries. These libraries can be used to build user applications quickly.

  • libecat_slave_stack_gcc.a   -   EtherCAT Slave Stack library including PRU Firmwares.

SDK Path -
                                        $(IA_SDK_HOME)\protocols\ethercat_slave\stack_lib\am437x
                                        $(IA_SDK_HOME)\protocols\ethercat_slave\stack_lib\am335x

  • libethernetip_stack.a    -  EtherNet/IP Slave stack library

SDK Path -
                                        $(IA_SDK_HOME)\protocols\ethernetip_adapter\stack_lib\am437x
                                        $(IA_SDK_HOME)\protocols\ethernetip_adapter\stack_lib\am335x

  • libprofibus.a                -  Profibus Slave stack library

SDK Path -
                                        $(IA_SDK_HOME)\protocols\profibus_slave\stack_lib\

  • libprofinet_slave_stack_gcc.a       -  Profinet Slave stack library

SDK Path -
                                        $(IA_SDK_HOME)\protocols\profinet_slave\stack_lib\am437x
                                        $(IA_SDK_HOME)\protocols\profinet_slave\stack_lib\am335x

  • libsnmp_core_gcc.a       -  SNMP core stack library

SDK Path -
                                        $(IA_SDK_HOME)\protocols\snmp_core\stack_lib\am437x
                                        $(IA_SDK_HOME)\protocols\snmp_core\stack_lib\am335x

  • libsys_bios_driver.a  -  SYS/BIOS specific implementation for accessing peripheral devices and EVM functionality

SDK Path -
                                        $(IA_SDK_HOME)\os_drivers\lib\am437x
                                        $(IA_SDK_HOME)\os_drivers\lib\am335x

  • libboard.a  -  StarterWare library for board details

SDK Path -
                                        $(IA_SDK_HOME)\starterware\binary\board\lib\am43xx-evm\a9\ccs\am43xx_release
                                        $(IA_SDK_HOME)\starterware\binary\board\lib\am335x-evm\a8\ccs\am335x_release

  • libdal.a  -  Starterware DAL specific initialization library

SDK Path -
                                        $(IA_SDK_HOME)\starterware\binary\dal\lib\am43xx-evm\a9\ccs\am43xx_release
                                        $(IA_SDK_HOME)\starterware\binary\dal\lib\am335x-evm\a8\ccs\am335x_release

  • libdevice.a  -  StarterWare library for peripheral devices

SDK Path -
                                        $(IA_SDK_HOME)\starterware\binary\device\lib\am43xx-evm\a9\ccs\am43xx_release
                                        $(IA_SDK_HOME)\starterware\binary\device\lib\am335x-evm\a8\ccs\am335x_release

  • libsoc.a  -  StarterWare SOC library

SDK Path -
                                        $(IA_SDK_HOME)\starterware\binary\soc\lib\am43xx-evm\a9\ccs\am43xx_release
                                        $(IA_SDK_HOME)\starterware\binary\soc\lib\am335x-evm\a8\ccs\am335x_release

  • libutils.a  -  Starterware Utils libary

SDK Path -
                                        $(IA_SDK_HOME)\starterware\binary\utils\lib\am43xx-evm\a9\ccs\am43xx_release
                                        $(IA_SDK_HOME)\starterware\binary\utils\lib\am335x-evm\a8\ccs\am335x_release


The SDK does not include any pre-built binaries, however binaries generated using SDK examples (given below) can be downloaded separately. All of the pre-built binaries except the bootloader are board independent. Please see the release notes for download location link.

  • endat_diagnostic - Sample application demonstrating EnDat master functionality.
  • ethercat_slave - Sample application demonstrating EtherCAT slave functionality.
  • ethernet_mac - Sample application demonstrating Ethernet MAC functionality over PRU-ICSS.
  • example_utils - Sample application demonstrating different peripherals on the board.
  • motor_control - Sample application demonstrating motor control.
  • profibus_slave - Sample application demonstrating Profibus slave functionality.
  • profinet_slave - Sample application demonstrating Profinet slave functionality.
  • sddf_gui_client - Sample application demonstrating SDDF functionality.



SYS/BIOS Driver[edit]

The Industrial SDK provides a driver library for accessing device peripheral modules from a SYS/BIOS application. This has implementation of PRU-ICSS NDK NIMU driver, PRU-ICSS LLD and ICSS-EMAC LLD sources and other utilities.  
. The project files can be found at IA_SDK_HOME/os_drivers. There are different build configurations present for AM3x and AM4x(am335x_release, am437x_release)

  • PRU ICSS LLD

PRU ICSS Low Level Driver helps the application/drivers to interface with the PRU Subsystem. This module has APIs which can be used to initialize PRU, load firmware and configure PRU-ICSS INTC etc.More information can be found in {IA_SDK_HOME}\os_drivers\docs

  • ICSS EMAC LLD

ICSS EMAC LLD (ICSS EMAC Driver) is an ethernet driver implementation over PRU-ICSS. The Driver enables the Ethernet capability of the PRU-ICSS with the help of firmware. This driver has APIs which enables communication between any High Level Driver/Application and EthernetIP or Profinet firmware. The ICSS EMAC Driver can support both EMAC mode and Switch mode (depending on the firmware loaded to PRU-ICSS). For more details please refer {IA_SDK_HOME}\os_drivers\docs


Board[edit]

The Industrial SDK provides a driver library for accessing device peripheral modules from an application. This has implementations for Digital Inputs, Digital Outputs, Flash memory(QSPI and SPI), Rotary Switch and LCD integrated  
The project files can be found at IA_SDK_HOME/board. There are different build configurations present for AM3x and AM4x(am335x_release, am437x_release)

Bootloader[edit]

Starterware provides a simple bootloader, which can be copied to an MMCSD card or flashed to QSPIflash/SPI Flash. Following a power-on-reset the MMCSD card or flash can bootstrap the board. Additionally, the Flash/SD card bootloader can load an application from the MMCSD card/Flash to DDR or Internal RAM and transfer the control to the application. This can be used to provide an application load from reset. Refer to the Starterware User Guide in {IA_SDK_HOME}\starterware\docs for more details on loading and building the Bootloader.


Examples[edit]

Following examples and the CCS project files for those are included in the IA-SDK installation package. For details on importing and building samples applications in CCS, please see the [SYSBIOS Industrial SDK Getting Started Guide]. 

The project files can be found at IA_SDK_HOME/examples. There are different build configurations present for AM3x and AM4x(am335x_release, am437x_release)

Supported Boards[edit]

Application/Board AM437x IDK AM335xICEv2
Endat master
Ethernet MAC ✓**
EtherNet/IP(ICSS) adapter ✓**
EtherCAT slave ✓**
Example Utils
Motor Control
Profibus slave
ProfinetRT/IRT device ✓**
SDDF GUI client ✓***
**Proper jumper settings required (EtherCAT works in ICSS mode only)

Jumpers J18 and J19 need to be set accordingly to select CPSW or ICSS mode. Pin2 and Pin3 need to be connected for ICSS mode and Pin1 and Pin2 for CPSW mode.

***Require Sigma Delta modulator and adapter card for AM437x IDK as in [1]



EnDat diagnostic[edit]

EnDat is a bidirectional interface for position encoders. During EnDat operation the EnDat master receives position information from the EnDat position encoder. The EnDat diagnostic application for SYS/BIOS demonstrates the EnDat master operation on the AM437x.
This application is controlled with a terminal interface using a serial over USB connection between the PC host and the EVM. Please connect a USB cable between the PC and the EVM. A serial terminal application (like teraterm/ hyperterminal/ minicom) is then run on the host. To configure, select the serial port corresponding to the port emulated over USB by the EVM. The host serial port should be configured to 115200 baud, no parity, 1 stop bit and no flow control. Connect EnDat encoder to on-board connector J10. EnDat encoder can be connected to on-board connector J10 (channel 0) or using additional transceiver circuitry to use channel 1 or 2 (see note)
The EnDat driver provides a defined set of API's to expose EnDat master interface. The diagnostic invokes these API's to initialize EnDat, configure the host trigger mode, select the channel and run the firmware. Once these steps are executed, the driver waits for the EnDat to be initialized. It then sets clock frequency to 200KHz (as propagation delay is not yet compensated) and obtains the encoder details including serial number, position resolution etc, and displays on the console. Based on the whether encoder is 2.2 or 2.1 type, it sets clock to either 8MHz or 1MHz respectively. While configuring clock above 1MHz, propagation delay is taken care using the automatically estimated propagation delay (user can override it too)
Once initial setup is over, the diagnostic provides the user with a self explanatory menu. Two types of menu options are presented. One type (1-14) will send an EnDat command as per EnDat 2.2 specification. The other type (100-107) allows the user to configure clock frequency, various timing parameters, simulate motor control loop using 2.1 command as well as 2.2 command with safety (redundant position information), switch to continuous clock mode and monitor raw data.
After the user selects an EnDat command, the diagnostic asks for more details to frame the command and performs a basic sanity check on the user entered values. Then the EnDat API is invoked to process the command. The received EnDat is processed & validated using the defined API's. The result is then presented to the user.

NOTE: To make channel 1 or 2 functional, additional transceiver circuitry required as in [2] (but this also makes SD boot non-functional) and R541 on AM437x IDK has to be removed.



EtherNet/IP[edit]

NOTE 1:  Permanent storage of Ethernet/IP device parameters are enabled and are stored in SPI Flash at various offsets as defined in file eip_main.h

NOTE 2: To add ACD(Address Conflict Detection) support in the application, a legacy method is used for configuring NDK parameters. In this approach configuring of NDK is done using the Configuration APIs rather than the XGCONF configuration tool within CCS. This is because a configuration added through XGCONF tool will be overridden. Please refer the link for more information on this approach.

NOTE 3: For passing the Subnet Mask tests (Test 4.1) specified in ODVA Conformance test report, rebuilding of the NDK is required. Macro _INCLUDE_ACD_SUPPORT must be defined in the file NDK_INSTALL_DIR\packages\ti\ndk\stack\lli\lliin.c . Then the NDK is rebuilt

NOTE 4: The Ethernet/IP application can be modified to work as a Switch application by removing the Ethernet/IP dependencies. The steps to create Switch application can be found here

NOTE 5: The NDK performance of the ICSS Emac Driver can be improved by increasing Queue size (Prioriy Queue 4 in case of Ethernet/IP). To enable this improvement change the macro QUEUE_4_SIZE in icss_switch.h from 97(3KB) to 194(6KB). However it is important that the total Queue size is not more than 12KB.


The example is an EtherNet/IP adapter demo application based on Molex EtherNet/IP stack on top of NDK TCP/IP stack  . The EtherNet/IP is an industrial networking standard that takes advantage of commercial off-the-shelf Ethernet communication chips and physical media. The EtherNet/IP uses an open protocol (CIP) at the application layer. This example is a limited demo application that is constrained so that a user will be allowed to execute it for one hour only. The EtherNet/IP adapter application is implemented over the low latency cut-thru switch implementation on ICSS
 

The Ethernet/IP on Industrial Communication SubSystem (ICSS) supports Beacon based DLR (Device Level Ring) node which is a ring redundancy protocol specified by ODVA, the main features of this implementation are

  • Supports 200 us beacon interval and 400 us beacon timeout interval
  • Supports learning table exception for Supervisor
  • Dynamic start and stop. User can enable or disable DLR on the fly
  • No user configuration required. The ring parameters get configured on their own.
     

The ACD(Address Conflict Detection) feature is enabled in the example. Upon startup, the application checks for the ACD enable bit stored in the SPI Flash (at offset SPI_EEPROM_ACD_OFFSET). If disabled, the application starts immediately, otherwise it waits for the link to come up. Once the link is established, the ACD mechanism is started. The IP Address is obtained once the ARP probing is done and no duplicate IP Address is detected.


This application allows the user to carry out the following actions and can be configured via the serial console

  1. Start mode – Start stack in IO exchange mode
  2. Stop mode – Stop IO exchange mode
  3. Run mode – In this mode IO Data will be exchanged with scanner
  4. Idle mode - No Data exchange with scanner. Only communication.
  5. Copy in-out mode – Copy the data from scanner to the OUT data.
  6. Increment mode – Stack will increment the OUT data periodically
  7. Change IP Address - IP address of the device can be configured manually.
  8. Erase Non Volatile Memory - This option will erase the stored device configurations from the non volatile memory


The stc file used for the ODVA CTT is provided along with the application in stc folder. The EDS file for the application is located at $(IA_SDK_HOME)\protocols\ethernetip_adapter\eds folder.The Ethernet/IP Application uses a Module status LED U1 on IDK and D1 on ICE V2) and a network status LED U2 on IDK and D2 on ICE V2).

For a quick checkout and demonstration of the EtherNet/IP functionality, an EIPTool, available for free from Molex, can be used to establish CIP connections and query or set CIP attributes. Additional details on using EIPTool with an example application can be found here Using EIPTool with AM335x EtherNet/IP Adapter Application


Running application on ICE V2
For operation with the ICE V2,  the Jumpers J18 and J19 must be set to ICSS mode. Pin2 and Pin3 are connected for ICSS mode. 


Ethernet MAC[edit]

This example is an Ethernet Dual mac implementation. The application has two MAC instances each having independent IP Address. By default following IP address will be taken

  • Port1 - 192.168.2.3
  • Port2 - 192.168.1.3

The IP address of Instance 2 (Port 2) is configured via CFG file. The IP Configuration of Instance 1 (Port1) is assigned in the Stack init hook Callback. This example runs on top of the ICSS EMAC driver and uses NDK as TCP/IP stack.The Ethernet MAC application is dependent on the libsys_bios_driver.a, libboard_support.a and a few Starterware libs. Once the application is loaded the details are print on Uart console. The TriColour LED (U1 on IDK and D1 on ICEv2) will blink Green to indicate the application is running

Dual mac application uses the ICSS EMAC Driver in emac mode. Here both firmwares which runs on both PRUs work independently hence the application can be modified to run as single MAC also. The ICSS EMAC driver need to be initialized accordingly to run in Dual/Single MAC mode. Refer to SYS/BIOS Driver section for more details. In addition to this there are a few changes in the QoS scheme. Out of the four Receive queues two are reserved for each Ethernet MAC. So Queue 1 and 2 are available exclusively for Port 1 EMAC while Queue 3 and 4 are availably only for PORT2 EMAC. On the transmit path there is no change and four queues are available for each port.


EtherCAT[edit]

NOTE 1: SDK Supports two different versions of EtherCAT application.
1 . Simple Demo Application  - An EtherCAT sample application built using  pre-built EtherCAT stack library (libecat_slave_stack_am437x.a). This allows limited development using SSC5.10 stack library via Sample Application Interface which provides controlling 32- bit input and 32-bit output. Object dictionary adaptation is not possible in this evaluation version. This will be the default configuration for EtherCAT. The project files for this application can be found in $(IA_SDK_HOME)\examples\ethercat_slave. The example application will be delivered in source, but the EtherCAT stack will be delivered in object format only.
2.  Full Feature Demo Application  -  This is a full-fledged application and provides full flexibility and configurability. However this application need access to complete stack source. As per the SLA terms, TI cannot distribute the stack (Beckhoff Slave Sample Code) in source format. Therefore, to build this application, user must get the SSC 5.10 source code from ETG website and apply the provided patch. The project files for this application can be found in $(IA_SDK_HOME)\protocols\ethercat_slave\ecat_appl. Please see the details in later sections. For more information, refer the section on "Building Full Feature EtherCAT Application" of this document. This application includes motor control functionality
NOTE 2:   Both EtherCAT applications support non-volatile storage of ESI EEPROM. The application writes the data into non-volatile QSPI memory only in INIT and PREOP states. This can be disabled or enabled on full featured application by defining/undefining EEPROM_SPI macro in tiescbsp.h. This feature cannot be modified in limited demo

This folder has TI EtherCAT slave simple demo application along with configuration xml file. The user can start and build the CCS6 project named EtherCAT. Upon a successful build, a file named "EtherCAT_ti.bin" will be generated (in sdk\examples\EtherCAT_slave\Debug__GNU). This can be flashed to QSPI or copied to SD card. Please see the [Getting Started Guide] for details on building an application. Alternatively, "ethercat.out" can be load/run from CCS to A8 (AM335x) or A9 (AM437x).
This application demonstrates the EtherCAT interface, LED light controls. If the Full Featured EtherCAT Application is available, the application will also demonstrate a motor control application.

The Motor Control application demonstrates a sensored 3 phase sensored Field Oriented Control (FOC) for a single Permanent Magnet Synchronous motor (PMSM) using the onchip AM437x ADCs (default) or sigma delta decimation filtering (requires additional modulator & interface card [3] and ADC_SDDF macro has to be defined in the project) and optionally the EnDat 2.2 master interface with a EnDat encoder attached to the motor. The Motor control application has been validated using a Permanent Magnet Motor (BLY171D-24V-4000, Anaheim Automation). This is coupled to an EnDat 2.2 encoder (ROQ 437, Heidenhain). In this demonstration the Motor drive is provided by the IDK over the three terminals of J17. If no encoder is used or an encoder is available and attached to the longer shaft of the motor, then the connections from the EVM to the motor are: The Red wire from the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Yellow wire of the motor should be connected to J17-3. Alternatively, if the encoder is attached to the shorter shaft of the motor, then the connections from the EVM to the motor are: The Yellow wire of the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Red wire from the motor should be connected to J17-3. The encoder should be to be connected to the onboard connector J10.

If sigma delta decimation filtering is used, AM437x IDK J17-1,2 & 3 to be connected to negative of channel 3, 2 & 1 of modulator card respectively. Then consider positive terminal of channel 3, 2 & 1 as J17-1, 2 & 3 and make the connections as mentioned in the above paragraph.

To test TI EtherCAT slave sample app - one can use TwinCAT or any other compatible EtherCAT master. Below are the steps to use TI slave with TwinCAT. Additional details on TwinCAT configuration can be found at here.


  1. Install TwinCAT3 (A one month evaluation is available for free download from the Beckoff website TwinCAT 3 Download. Select the eXtended Automation Engineering (XAE) mode of installation.
  2. Copy sdk\examples\ethercat_slave\esi\TiEtherCATLib.xml to <Drive>:\TwinCAT\3.1\Config\Io\EtherCAT folder
  3. Start the TwinCAT XAE (VS2010)
  4. Create a new TwinCAT XAE project: File > New > Project > TwinCAT Project
  5. Goto TwinCAT > Show Real Time Ethernet Compatible Devices and Install TwinCAT RT Ethernet intermediate driver. For best performance - it is recommended to use a compatible NIC card listed Supported Network Controller by Beckhoff Ethernet Driver . Note, please always check ethernet adapter is listed below "installed and ready to use devices" before attempting to run TwinCat demo.
  6. Connect CAT5 Ethernet cable from TwinCAT PC to EtherCAT IN/Port0 (J1 in AM335x, J6 in AM437x) of IDK. If you have multiple IDKs in chain, please connect from EtherCAT OUT/Port1 (J2 in AM335x. J9 in AM437x) to Port0 of next IDK. For the last IDK in chain, Port1 will be left open.
  7. In Solution Explorer go to your new TwinCAT project > I/0 > right click Device1(EtherCAT)> select Scan Boxes... If Scan Boxes is grayed out then select TWINCAT > Restart TwinCAT (Config Mode)
  8. TI Boxn(ti-esc) will be detected automatically. If running TwinCAT 2 on Windows XP - Now select Device1 (EtherCAT) and goto Actions > Select Set/Reset TwinCAT to Config Mode or use shortcut SHIFT-F4. Alternatively - If running TwinCAT 3 on Windows 7 - Now select Device1 (EtherCAT) and goto TwinCAT and then Reload Devices.
  9. A dialog will pop asking Load I/O Devices, select Yes
  10. Next dialog asks confirmation to Activate Free Run - select Yes. This will put TI ESC into OP mode. Alternatively, you can use "Toggle Free Run State" bottom.
  11. The application should show digital out LEDs 1 to 8 to on. This indicates that slave is up and in INIT state. The EtherCAT device state can be displayed by selecting a Device (Double click on Device) and then selecting the Online tab. The device should be in the OP state with no Lost frames or Tx/Rx/ Errors. If another mode or errors are shown the interface can be reinitialized by performing Step 7.
    On startup, the application will set digital out LEDs 1 to 8 to on . This indicates that slave is up and in the INIT state.
    Twincat Device.jpg

    Figure 2 TwinCAT Status / Control Display
  1. The user can control digital out LEDs using TwinCAT. Select TI Boxn(ti-esc)>DO Outputs > LED1-8 to control the output LEDs.
    1. The LEDs are set by selecting an LED N and then selecting the Online tab.
    2. The LED is turned on and off by selecting write and setting the value to 1 and 0 respectively.
    Twincat LED.jpg

    Figure 3 TwinCAT LED Control Display
  1. To control the Motor using TwinCAT.(Available in full application ONLY),
    1. The Motor speed is set by selecting  TI Boxn(ti-esc)>Motor Outputs->Data and selecting the Online tab. The speed can be set a value between 1000 (for 4000 rpm in the forward direction) and -1000 (4000 rpm in the reverse direction). This same Data field also serves as the position input (in position control mode). In the position mode, a 0 corresponds to 0 degree, while a 1000 corresponds to 360 degrees.
    2. The value is entered into the controller by selecting the Write button, entering a value, and selecting OK.
    Twincat Motor.jpg

    Figure 4 TwinCAT Motor Control Display
  2. The Command box permits the setting of the lsw variable.
    The Count box permits the setting of the msw variable.
    Please refer below to the block diagram for the illustration of the lsw & msw variable function.
    The default build level for the FOC motor control is LEVEL4 (closed speed loop with EnDat position feedback). The Build level can be changed using BUILDLEVEL in foc.h and then rebuilding the project. In LEVEL4, controlling variables are lsw and speed. The default value of lsw is 0. For an open speed loop set lsw to 1. Set lsw to 2 for a closed speed loop.
    Level4Jan29 15.jpg

    Figure 5 TwinCAT FOC Level 4
    In LEVEL5, the controlling variables are lsw and angle. In this configuration, lsw = 0 (default) is the position control is turned off. To enable position control set lsw to 1 or 2. 1. As described earlier, the position is set by selecting TI Box (TIESC-00n) -> Motor Outputs -> Data and selecting the Online tab. The position can be set a value between 0 and 1000. A 0 corresponds to 0 degrees, while a 1000 corresponds to 360 degrees. The value is entered into the controller by selecting the Write button, entering a value, and selecting OK.
    Level5Jan29 15.jpg

    Figure 6 TwinCAT FOC Level 5
    LEVEL6 is a combination of LEVEL4 & LEVEL5. In Level 6 the control variables are msw, lsw, speed and angle. When msw = 0 (default), the FOC is operating in speed control mode. In this mode, use the lsw and speed settings as discussed previously in LEVEL4. The angle input is not used in when msw = 0. To include position control set msw = 1. In this mode, the angle control operates as described in LEVEL5. In this configuration, the speed and lsw settings are ignored.
    Level6Jan29 15.jpg

    Figure 7 TwinCAT FOC Level 6

For more information, Please see Configuring TwinCAT for TI EtherCAT Slave


Example Utils[edit]

The Example Utils application illustrates how various peripherals can be accessed from a SYS/BIOS application. This application demonstrates Digital Outputs, Digital Inputs, Rotary Switch and Flash memory(SPI on ICEv2 and QSPI on IDK). This application also utilizes the LCD panel on ICEv2.

On loading the application, a menu will appear on UART terminal to trigger various peripherals.

This application is dependent on the libsys_bios_driver.a, libboard_support.a and a few Starterware libs. The project files for these libraries are included in the SDK and they can be rebuild with any modification required. Upon modifying and building libraries, users should re-build the application as well.


Motor Control[edit]

The Motor Control demo demonstrates a sensored 3 phase sensored Field Oriented Control (FOC) of a single Permanent Magnet Synchronous motor (PMSM) using the onchip AM437x ADCs (default) or sigma delta decimation filtering (requires additional modulator & interface card [4] and ADC_SDDF macro has to be defined in the project) and optionally the EnDat 2.2 master interface and a EnDat encoder attached to the motor. The FOC algorithm provides smooth speed control, with high dynamic performance. The FOC algorithm transforms the 3 phase AC current measurements to d-q axis values allowing control of torque and flux. This application requires that the USB port of the EVM is connected to the host PC to enable a UART over USB connection between the EVM and host PC. A serial terminal application (like teraterm/ hyperterminal/ minicom) is then run on the host. To configure the terminal, select the serial port corresponding to the port emulated over USB by the EVM. The host serial port should be configured to 115200 baud, no parity, 1 stop bit and no flow control.

The Motor drive is provided by the IDK over the three terminals of J17. If no encoder is used or an encoder is available and attached to the longer shaft of the motor, then the connections from the EVM to the motor are: The Red wire from the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Yellow wire of the motor should be connected to J17-3. Alternatively, if the encoder is attached to the shorter shaft of the motor, then the connections from the EVM to the motor are: The Yellow wire of the motor should be connected to J17-1. The Black wire from the motor should be connected to J17-2. The Red wire from the motor should be connected to J17-3. The encoder should be to be connected to the onboard M12 connector J10.

If sigma delta decimation filtering is used, AM437x IDK J17-1,2 & 3 to be connected to negative of channel 3, 2 & 1 of modulator card respectively. Then consider positive terminal of channel 3, 2 & 1 as J17-1, 2 & 3 and make the connections as mentioned in the above paragraph.

The Motor control application has been validated using a Permanent Magnet Motor (BLY171D-24V-4000, Anaheim Automation). This is coupled to an EnDat 2.2 encoder (ROQ 437, Heidenhain). The motor can be controlled via terminal console. If an EnDat encoder is attached - Upon executing the run command the terminal window will display.
EnDat initial.jpg

Figure 8 EnDat Display when Encoder is Attached
If an EnDat encoder is not attached - Upon executing the run command the terminal window will display.
EnDat initial noEncoder.jpg

Figure 9 EnDat Display when Encoder is Not Attached


Upon pressing enter in the console, user will be asked to enter motor control variables. Simply pressing enter will bypass the setting of any variable. This is helpful, especially when only one variable needs to be changed. The meaning of these variables will change slightly with each of the different build levels. The default build level is LEVEL4 (closed speed loop with EnDat position feedback). The Build level can be changed using BUILDLEVEL in foc.h and then rebuild the project.

In LEVEL4, controlling variables are lsw and speed. The default value of lsw is 0. For an open speed loop set lsw to 1. Set lsw to 2 for a closed speed loop. The motor, BLY171D-24V-4000, has a maximum speed of 4000 RPM. The desired speed can be expressed as an RPM value in the range of 0 to 4000. To reverse rotation, a negative value is entered. In LEVEL5, the controlling variables are lsw and angle. In this configuration, lsw = 0 (default) is the position control is turned off. To enable position control set lsw to 1 or 2. The desired position can be specified as an angle in the range 0-360 to control the position.
Level4Jan29 15.jpg

Figure 10 FOC Level 4
In LEVEL5, the controlling variables are lsw and angle. In this configuration, lsw = 0 (default) is the position control is turned off. To enable position control set lsw to 1 or 2. The desired position can be specified as an angle in the range 0-360 to control the position.
Level5Jan29 15.jpg

Figure 11 FOC Level 5
LEVEL6 is a combination of LEVEL4 & LEVEL5. In Level 6 the control variables are msw, lsw, speed and angle. When msw = 0 (default), the FOC is operating in speed control mode. In this mode, use the lsw and speed settings as discussed previously in LEVEL4. The angle input is not used in when msw = 0. To include position control set msw = 1. In this mode, the angle control operates as described in LEVEL5. In this configuration, the speed and lsw settings are ignored.
Level6Jan29 15.jpg

Figure 12 FOC Level 6


NOTE 1: Before proceeding with closed speed loop or position control ensure that encoder is connected and coupled to the motor and position offset compensation updated as mentioned below
NOTE 2:It is recommended to bring motor to a standstill before connecting/disconnecting through JTAG
NOTE 3:In LEVEL6, before switching from position control to speed control and viceversa, ensure that speed/position is set to zero (eg. before switching from speed control to position control mode, make speed as 0) and verify that the motor is at a standstill
NOTE 4:Use power supply provided with AM437x IDK

ADC sampling firmware using ICSS0_PRU1[edit]

This firmware makes use of the PRU C compiler assembler and linker integrated in CCS6.x onwards. Additional detail on that is available is contained the following documentation.

PRU Optimizing C/C++ Compiler v2.0, http://www.ti.com/lit/ug/spruhv7/spruhv7.pdf PRU Assembly Language Tools v2.0 User's Guide http://www.ti.com/lit/ug/spruhv6/spruhv6.pdf

sdk\interfaces\pru_onchip_adc_sampling\firmware has the example firmware implementation for ADC sampling and PWM & ADC synchronization

  • icss_cfg_regs.hp: Register offsets for PRU_ICSS_CFG registers
  • icss_cntl_regs.hp: Register offsets for PRU_ICSS_CTRL registers
  • icss_ecap_regs.hp: Register offsets for PRU_ICSS_ECAP registers
  • icss_event_defs.hp: PRU_ICSS system event defines
  • icss_iep_regs.hp: Register offsets for PRU_ICSS_IEP registers
  • icss_intc_regs.hp: Register offsets for PRU_ICSS_INTC registers
  • icss_regs.hp: PRU_ICSS local memory map defines and Constant table entries

For more details on above, refer to AM437x TRM Chapter 30

  • pru_adc_sampling_macros.hp: Reference macro implementations for legacy pasm CALL and RET instructions using clpru macros
  • pru_adc_sampling.hp: Various configuration and register variable defines for ADC sampling firmware
  • pru_adc_sampling.asm: Main assembly source file which implements ADC sampling and PWM to ADC synchronization using IEP timer module
  • pru_adc_sampling.cmd: Command file for clpru linker (generates .out file from .obj files)
  • pru_adc_hexpru.cmd: Command file for hexpru tool (generates .bin file from .out file)
  • build_pru_adc_sampling.bat Bat file to build firmware C array header from assembly input files. Set PRU_C_COMPILER_PATH to PRU C compiler tool path

E.g.:-"C:\ti\ccs6\ccsv6\tools\compiler\pru_2.0.0B2") .project,.ccsproject, .cproject: CCS 6.x project files to build .out (for debugging firmware) and C array header (to be included in applications) from assembly sources

NOTE: sdk\tools\bin2header\bin2header.exe generates pasm compatible PRU firmware C array header from hexpru generated .bin files. Source code for the same is available in the same folder. Usage : bin2header.exe input_binary_file output_C_header_file output_array_name 4/1 [4: 32-bit hex values 1: 8-bit hex values (default)]


PRU ADC sampling firmware Host interface[edit]

Maintained in ICSS0 PRU1 Data memory (base address: 0x54442000)

  • FOC_CONTROL_OFFSET(0x54442050): Indicate to PRU firmware when Host is ready for FOC processing 0: Wait 1: Continue
  • FOC_TRIGGER_OFFSET(0x54442054): Select when to issue End of Conversion (EOC) to Host. On ADC EOC event (FOC_TRIGGER_IS_ADC) or on ADC EOC & EnDat EOC event (FOC_TRIGGER_IS_ENDAT). FOC_TRIGGER_IS_ADC is used today
  • FOC_IEP_PWM_PERIOD_OFFSET(0x54442058): Configure the PWM_PERIOD for ICSS0 to track and synchronize the ADC events w.r.t PWM period (nano sec units)
  • FOC_IEP_ADC_SOC_TRIGGER_OFFSET(0x5444205C): Configure ADC_SOC trigger time period from host (nano sec units)
  • FOC_IEP_ENDAT_SOC_TRIGGER_OFFSET(0x54442060): Configure ENADT_SOC trigger time period from host (nano sec units)
  • FOC_IEP_PWM_SYNC_OFFSET(0x54442064): Adjust IEP counter w.r.t PWM counter, program the IEP counter init value when PWM counter is cleared during synchronization phase (nano sec units)

PRU ADC sampling firmware overview[edit]

The Host will setup the PRU_ICSS INTC mapping, initialize PRU memories, initialize firmware configuration variables, download and start the firmware execution…

Init:
  1. Firmware clears all registers and wait for Host interface to be ready polling FOC_CONTROL_OFFSET
  2. When host CPU is ready, firmware initialize IEP CMP registers with PWM_PERIOD, ADC_SOC_TRIGGER, IEP_PWM_SYNC values programmed by host.
    1. PWM_PERIOD (CMP0) is 100000 (100us ) for 10 KHz
    2. ADC_SOC_TRIGGER (CMP1) is 50000 (50us) - mid point in PWM cycle
    3. IEP_PWM_SYNC is set to 50000 (50us)
  3. Clear all pending events for ADC, PWM, IEP and INTC
  4. Align PWM_TBCNT and IEP_COUNTER based on IEP_PWM_SYNC
Main loop:
  1. Firmware poll for IEP_CMP_HIT event, if match and ADC_SOC_TRIGGER (CMP1) then generate ADC_SOC via ICSS0_HOST5 > ICSS1_HOST0 >ADC1_EVT_TRIGGER connection
  2. Firmware poll for ADC_EOC event (from ADC register) if match then read samples from ADC FIFO, store to PRU data memory in required format and generate ADC_EOC to host cortex A9

Sigma Delta Decimation Filter[edit]

This is also integrated as a CCS project, PRU firmware sources are available @"interfaces\sddf\firmware".

Sigma Delta is configured to triggered mode in motor control application using relevant API's. In triggered mode, it is synced to PWM. And pre-triggering time from PWM reversal point is configured to half of three sample time for the default configurations (OSR128, 20MHz modulator clock). Three sample is the Sinc3 settling time and sampling around the PWM reversal instant to reduce harmonics in the current, hence pre-triggering with half the settling time. Upon processing the third sample, PRU will trigger ARM interrupt and that will cause FOC loop to run.

Sigma Delta firmware also has capability to optionally generate an additional event synced to PWM, it is leveraged to make EnDat run in trigger mode.

Refer for more details, firmware design, API guide as well as interface guide in "interfaces\sddf\doc" and Sigma Delta Decimation Filter GUI client example section


EnDat[edit]

EnDat is configured initially to host trigger mode to extract details about the encoder. Once details are obtained, it is switched to periodic mode and the command to be sent (2.2 position) periodically is also setup. The triggering instant configured by ADC PRU ensures the completion of EnDat command by the time FOC interrupt occurs. During the execution of FOC interrupt, a lightweight EnDat API is invoked to read angular position for the already completed EnDat 2.2 position command.

Refer for more details, API guide in "interfaces\endat_master\doc".

Field Oriented Control (FOC)[edit]

The Field Oriented Control (FOC) algorithm is used to control the motor. This implementation is derived from the C2000 PMSM sensored servo FOC.

The FOC implementation used in this application has 6 LEVEL's. LEVEL4 and LEVEL5 are the ones that would normally be used in most applications. LEVEL3 and LEVEL6 are included primarily for demonstration purposes. LEVEL1, 2 and 3 are used during system bring up and tuning.

Description of different LEVEL's (all below are with closed current loop),
LEVEL3 - open speed loop
LEVEL4 - open speed loop, closed speed loop with EnDat feedback
LEVEL5 - position control with EnDat feedback
LEVEL6 - combination of LEVEL4 & LEVEL5 selection between it can be performed at runtime


Position Offset Compensation[edit]

The position value reported by encoder at zero electrical angle of the motor has to be set to zero. The position offset compensation value helps in correcting it. Position offset compensation between motor and encoder can have different values with a relative angular position between them. There are two methods to determine the poc as follows,


1. A reliable, precise (and difficult) means to determine the poc is to incrementally change the position offset compensation and find the value at which q-axis value (at memory location 0x54442204) and the d-axis value (at memory location 0x54442104) current drawn is minimum.

2. Poc quick estimate for a coupled motor and encoder set – automatically detected poc value is available in memory location 0x54442030 as a floating point number. This is available within a second of the time that the motor has started running in a closed speed loop (lsw = 2) at LEVEL4. Repeat this step for 10 times (restart every time), and note down the poc value for all the cases where motor runs properly till 75% rated speed. Some times motor may go out of step or over current may happen, discard the values in those case. Average the value for successful cases.


Once the position offset compensation value is obtained, using either of the above methods, replace the following code in foc.c,

#if (BUILDLEVEL < LEVEL5)
_iq OffsetE = _IQ(0.0);
#else
_iq OffsetE = _IQ(-0.67);
#endif
Uint32 ElecThetaCalibrateFlag;

TO:

_iq OffsetE = _IQ(<new position offset compensation value>);
Uint32 ElecThetaCalibrateFlag = 1;

The above updates position offset compensation value to be used for LEVEL4, LEVEL5 & LEVEL6.


PI Tuning[edit]

The FOC algorithm uses several PI controllers. For a given setup, it may be necessary to tune the current, speed and position PI controller parameters. These variables are exposed through the PRU shared memory, which is modifiable at runtime using CCS. To change these values, first go to the CCS debug window. To enable the Non Debuggable Devices display, right click on AM437x_XDS100V2.ccxml [Code Composer Studio - Device Debugging] and select “Show all cores” . Then select Texas Instruments XDS100v2 USB Emulator_0/CS_DAP_DebugSS Connect using Non Debuggable Devices -> CS_DAP_DebugSS, add relevant variables to it (don't forget to typecast it to float).

PI structure base address as follows (refer control/math_blocks/pi.h for more details),

d-axis current (id) - 0x54442100
q-axis current (iq) - 0x54442200
speed (spd) - 0x54442300
position (pos) - 0x54442400

The values that would have to be changed are:

Proportional gain (Kp) - 0xC
Integral gain (Ki) - 0x10
Maximum limit (Umax) - 0x14
Minimum limit (Umax) - 0x18

Eg., if you want to change Kp for speed PI, modify 0x5444230c (0x54442300 + 0xC)



Profibus[edit]

NOTE: As per the SLA terms, TI cannot distribute the PROFIBUS slave stack from Technologie Management Gruppe (TMG) Code in source format. An evaluation library is provided with this release. For production use, please obtain the license and software directly from TMG.

This application uses drivers.lib, am335x_platform.lib, sys_bios_driver.lib, utils.lib, platform.lib, system.lib, and profibus.lib. The project files for these libraries except for profibus.lib are included in the SDK. They can be rebuild with any modifications required. Upon modifying and building libraries, it is recommeded to re-build the application as well.

Texas Instruments use PROCENTEC's ProfiTrace 2.6.1 to test the TI PROFIBUS DP slave sample app.. However, any PROFIBUS master can be used. Alink is the link to set up PROCENTEC's ProfiTrace 2.6.1 master is http://www.procentec.com/downloads/profitrace/ProfiTrace2-Manual-EN.pdf

A quick guide to set up TI Profibus slave with master is: http://processors.wiki.ti.com/index.php/PROFIBUS_DP_slave_demo_setup_on_AM335x

To set up the board the following steps are taken:

  • On the master side:
    • Copy PRU_OCDA.gsd file provided in the SDK into master GSD library
    • Scan the GSD library in the master
    • Create/Add "AM335x Evaluation Module (EVM)" slave in the project/network
    • Add modules (for e.g. 8byte input, 8byte output which is default) for the slave and activate
    • Initialize master, set baud rate, and operate
  • On the slave side:
    • For ICE V1 : Set Jumper on J7 (pin 1 and 2), J6, and J5 as shown and remove Jumper J4
    • For ICE V2 : Set Jumpers between pins 2 & 3 on J18 and J19 to slect ICSS mode
                         Set jumper on J7, J8 ( pin 1 and 2) and J10. Remove Jumper on J6
    • After powering on the board the bootloader will load the APP from SDMMC/SPI flash/NOR flash into DDR/Internal RAM/Cache
    • The boot logs can be seen on serial console
    • The APP waits for 5 sec to obtain the station address from serial console, if nothing is set then assume that the default station address 5. For changing the station address connect serial console as shown in the above snap shots. Hit Enter key to change station address, then enter the valid station address and hit enter again to start the APP. For ICE board after powering on and connecting the serial console, press the reset button to set the station address.
    • APP will print the menu on the serial console.
      • The input can be changed by pressing 'i' on keyboard
      • The master output updates are seen on serial console and output byte 3 toggles the LEDs on top of J17 (in IDK) or below J9 (in ICE) in a pattern sent by the master on byte3 (enable watchdog/modify I/O)
      • 'd' gives the DP status - 0x80 or 0x81 indicates the data exchanges, 0x0 indicates that data exchange is stopped



PROFINET RT/IRT[edit]

NOTE 1: PROFINET I/O RT/IRT Device is certified by COMDEC for Conformance Classes A, B and C
NOTE 2: As per the SLA terms, TI cannot distribute the PROFINET slave stack code from Molex in source format. The evaluation library is provided with this release. For production use, one has to obtain the license directly from Molex
NOTE 3: As per the SLA terms, TI cannot distribute the SNMP stack code from Interniche in source format. The evaluation library is provided with this release. For production use, one has to obtain the license directly from Interniche. Please refer section Building full feature SNMP stack to rebuild the SNMP stack

This example is a PROFINET I/O RT/IRT Device(slave) application based on Molex PROFINET stack. PROFINET is a real-time Ethernet standard for high-speed, deterministic communications used in a wide range of industrial applications including factory automation, process automation and building automation.

This example also incorporates SNMP(Simple Network Management Protocol) using Interniche SNMP stack. SNMP is required for managing devices in the network. This application supports SNMP MIB-2(System and Interfaces), LLDP-MIB, LLDP-EXT3-MIB and LLDP-PNO-MIB which are mandated for Conformance Class B. Current implementation of the LLDP-MIBs are limited in nature as the integration between PROFINET stack and SNMP interface is incomplete. The SNMP stack available in the example is a limited version, and shuts down after 1024 SNMP requests.

During start-up, the I/O Device is assigned an IP Address of 0.0.0.0 . The PROFINET master will have to configure the desired IP Address and device name to the I/O device before an I/O connection can be established with the device. Once the application is up, PROFINET I/O RT/IRT device will start communicating with a PROFINET PLC, or a PROFINET IO Tester or SPIRTA.

The GSD file used for configuring the I/O Device in the master side is provided along with the application in GSD folder.

PROFINET I/O RT/IRT Device has an integrated two-port cut-through learning switch. Switch handles the non real-time traffic and it has been interfaced with the PROFINET stack and TCP/IP (NDK) stack. It implements the PROFINET Quality of Service (QoS) using four priority queues on host and port interfaces. It implements PROFINET Filter Database for multicast addresses.Please see AM335x NDK driver API Guide for details on NDK based ICSS switch driver.

On ICE V2 and AM437x IDK, the LED will blink in orange when the application is running.

A simple sample I/O Application has been provided to demonstrate the usage of PROFINET implementation. All the 1440 bytes of output data are exposed to the application. Sample I/O application simply uses the first byte of output data and maps it to the Digital Output LED's on the board. It also implements a mechanism to read the Digital Inputs. Interpretation of Digital Inputs by sample application is described below:

  • Setting Jumper on Digital Input 0 generates an Alarm. This is an external way to manually generate the alarms from the I/O device.
  • Setting Jumper on Digital Input 1 generates a bit shift pattern input. Application reads this input and transmits to PLC.
  • Setting Jumper on Digital Input 2 generates a fixed test data input.

User can write a simple PLC program where input data of I/O device is transmitted back by PLC as output data. For example, a Jumper can be inserted in Digital Input 1 on I/O device to generate a bit shift pattern which is then transmitted back by PLC to demonstrate the moving LED light on the Digital Output LED's.

Details on setting up a PROFINET Connection with a PLC is included in sdk/protocols/profinet_slave/docs

The PROFINET Driver API guide is available here - sdk/protocols/profinet_slave/Docs/AM335X_Profinet_Slave_RT_API_Guide.chm


Running application on ICE V2
Jumpers J18 and J19 need to be set properly to select ICSS mode. Pin2 and Pin3 need to be connected for ICSS mode 


Sigma Delta Decimation Filter GUI client[edit]

Sigma delta A/D converters combine oversampling analog sigma delta modulators with digital decimation filters to achieve high precision and cost effective A/D conversion. This application demonstrates Sigma delta A/D conversion using AM437x IDK along with AMC1304 Sigma Delta modulator. Sigma Delta modulator provides a stream of one's and zero's that correspond to analog value. The digital stream from AMC1304 modulator card is fed to PRU Sigma Delta channels via adapter card. PRU has hardware support to integrate modulator output and provide the result in accumulators that can be Sinc2/3 based on the configuration, in the present case configured to Sinc3. The accumulator result is processed (simple differentiation) in PRU firmware to get the digital sample value.

This application provides the hence obtained sample value to host PC via UART. Sinc3 OSR can be configured from host using a GUI. Clock for the modulator is provided by PRU and is configured by default to 20MHz. Refer for more details, Isolated Current Shunt and Voltage Measurement Reference Design for Motor Drives Using AM437x. It also gives details on installing and using the GUI in host PC to observe the wave forms and analyze it.

Firmware also has Sinc3 based over current detection capability, DIGIO 7 available @J3-8 will be raised high if overcurrent occurs, details about this too can be found in the TI design.

Application configures firmware to continuous mode to do continuous sampling. More details about Sigma Delta design, API guide and Interface guide can be found @"interfaces\sddf\doc".


NOTE: This application required modulator card and adapter card to be connected to AM437x IDK as mentioned in [5]



Building Full Feature EtherCAT Application[edit]

The EtherCAT example application provided in $(IA_SDK_HOME)\Examples\EtherCAT folder is a limited development application. To have a full development capability on AM335x/AM437x, it is necessary to get the EtherCAT source code from Beckhoff and use that with the SDK example application. The SDK example application provides all board specific implementation sources for EtherCAT and a patch file to modify Beckhoff source files for the AM335x/AM437x. This application can be found in $(IA_SDK_HOME)\protocols\EtherCAT\ecat_appl. This folder also includes the configuration xml file to be used for testing and it can be found in $(IA_SDK_HOME)\protocols\EtherCAT\ecat_appl\esi folder.

The steps for building full feature EtherCAT application using Beckhoff source are given below.

  1. Download EtherCAT stack version 5.11 from ETG website and extract it to a local folder.
  2. Apply ( See Apply instructions below) TI_ECAT.patch file found at $(IA_SDK_HOME)\protocols\ethercat_slave\ecat_appl\patch on extracted Beckhoff stack code.
  3. Copy the patched Beckhoff source files (.c and .h) to $(IA_SDK_HOME)\Protocols\ethercat_slave\ecat_appl\EcatStack
  4. Launch CCS and import ecat_appl project found at $(IA_SDK_HOME)\Protocols\ethercat_slave\ecat_appl to CCS
  5. Define macros in ecat_appl\EcatStack\ecat_def.h as required for your application. (a) Ensure that TIESC_HW is set to 1. (b) For running default application, set TIESC_APPLICATION to 1 and CiA402_DEVICE to 0. For running CiA402 application, set TIESC_APPLICATION to 0 and CiA402_DEVICE to 1.
  6. Build the project. This will generate the application binary which can be used to run on AM335x/AM437x.

Applying a Patch file

  • Download Windows Patch Utility from gnuwin32 sourceforge. ( Note that this is not a TI tool - See licensing information page for more details)
  • Extract the zip file to the Windows PC. Patch file utility(Patch.exe) can be found in bin folder.
  • Launch DOS Command prompt ( Start->Run->cmd).
  • CD to bin folder.
  • Execute patch.exe as given below

                 patch.exe -i PATCH_FILE_NAME -d SOURCE_DIR

                 where PATCH_FILE is name of the patch file with full path and

                          SOURCE_DIR is Directory with full path where source files are present.

Example :

patch.exe -i C:\TI\sysbios_ind_sdk_2.0.0.1\sdk\protocols\ethercat_slave\ecat_appl\patch\TI_ECAT.patch -d c:\SSC_V5i0\SlaveFiles\src

Generating ESI Header file From ESI xml
[edit]

The above given EtherCAT application is expected to be used against the ESI xml file given in esi folder.If the application should work with another ESI xml file, user will need to generate a corresponding ESI header file ( tiesc_eeprom.h ) and re-build the ecat_appl with the generated .h file.

Steps for generating ESI header file is given below.

  • Generate the binary file equilant to ESI xml file. Pease see Generating EEPROM binary.
  • Convert the binary file to header file using the bin2header.exe utility. This utility can be found in  $(IA_SDK_HOME)\tools\bin2header

Usage :
'bin2header.exe 'binary_filename' 'header_filename'

Example:
bin2header.exe "C:\Documents and Settings\user\Desktop\Box1.bin" "C:\Documents and Settings\user\Desktop\tiesc_eeprom.h" br>

  • Replace the existing file with new header file ( tiesc_eeprom.h) to $(IA_SDK_HOME)\Protocols\ethercat_slave\ecat_appl\src
  • Rebuild the application.


Building Full Feature SNMP stack[edit]

SNMP is provided as a library in the Industrial SDK with a limit of 1000 SNMP requests(after which it will shutdown). To have full development capability, users have to get the stack from Interniche SNMP Stack v4.01(please contact - http://www.iniche.com/snmp.php )

The SNMP stack project files can be found in $(IA_SDK_HOME)\protocols\snmp\snmp_core. Once the user has access to the stack source, they can copy the files into this folder and re-build the library to get full development access.

The steps for building full feature SNMP stack using Interniche SNMP source are given below.

  1. Copy the SNMP stack source to $(IA_SDK_HOME)\Protocols\snmp\snmp_core\source
  2. Launch CCS and import snmp_core project found at $(IA_SDK_HOME)\Protocols\snmp\snmp_core to CCS
  3. Build the project. This will generate the application binary(at $(IA_SDK_HOME)\Protocols\snmp\stack_lib) which can be used to run in application.


Building Bootloader[edit]

Boot loader project is included in the starterware package. The supported build configurations for AM437x are:

  1. am43xx_boot_mmcsd_debug - This configuration builds the application with no optimization in place , in 32 bit mode and with maximum debugging support. The size of the boot loader binary would be large. Builds the binary to be executed from SD card
  2. am43xx_boot_mmcsd_release - This configuration is optimized to an extent. Builds binary to be executed from SD card
  3. am43xx_boot_qspi_debug - This configuration builds the application with no optimization in place , in 32 bit mode and with maximum debugging support. The size of the boot loader binary would be large. Builds the binary to be executed from qSPI flash
  4. am43xx_boot_qspi_release - This configuration is optimized to an extent. Builds binary to be executed from qSPI Flash

The supported build configurations for AM335x are:

  1. am4335x_boot_mmcsd_debug - This configuration builds the application with no optimization in place , in 32 bit mode and with maximum debugging support. The size of the boot loader binary would be large. Builds the binary to be executed from SD card
  2. am335x_boot_mmcsd_release - This configuration is optimized to an extent. Builds binary to be executed from SD card
  3. am335x_boot_mcspi_debug - This configuration builds the application with no optimization in place , in 32 bit mode and with maximum debugging support. The size of the boot loader binary would be large. Builds the binary to be executed from qSPI flash
  4. am335x_boot_mcspi_release - This configuration is optimized to an extent. Builds binary to be executed from qSPI Flash

Once the build configuration is selected, follow the given steps to build the boot loader.

  • Import Bootloader project found at $(IA_SDK_HOME)\starterware\bootloader directory to CCS. See importing and building instructions section for details.
  • Import dependent starterware projects. They are board, dal, soc, utils, ff9b_lib and mmscd_lib. They can be located at $(IA_SDK_HOME)\starterware\
  • Select the appropriate build configuration for the bootloader. The dependent projects will automatically build
  • Set predefined macros as follows
  • Set the post build script arguments properly. See Post Build Script section for details.
  • Build bootloader project.

A Successful build will generate boot.out and binary file in $(IA_SDK_HOME)\starterware\binary\bootloader\bin\am43xx-evm\ccs\


Generating Executable Binary - Post Build Script[edit]

OBJCOPY is used to generate a binary(.bin) from a .out file. Then ri_image adds the ti_headers into the generated binary file(resulting in an _ti.bin)


Parameter List for Post build steps

  • Param 1 - OBJCOPY path
  • Param 2 - Output file format(Binary)
  • Param 3 - Input Image path name
  • Param 4 - Output Image path name
  • Param 5 - ti_image.exe path
  • Param 6 - Load address/Run address for the binary in hexadecimal format.(c_int00 should be forced to load address)
  • Param 8 - Boot mode. For bootloader, value of <boot mode> should be corresponding bootmedia name i,e NAND/SPI/MMCSD/UART. For application, value of <boot mode> should be NONE.
  • Param 9- Input Image path name
  • Param 10- Output Image path name

Example :-

Generate a bootloader binary to be stored in qSPI/SPI Flash or MMCSD

"${CG_TOOL_ROOT}/bin/arm-none-eabi-objcopy" -O binary --strip-all --strip-debug --strip-unneeded
"${PROJECT_BUILD_DIR}/${ProjName}.out" "${PROJECT_BUILD_DIR}/${ProjName}.bin" &
"${IA_SDK_HOME}/starterware/tools/ti_image/tiimage.exe" "0x80000000" "NONE"
"${PROJECT_BUILD_DIR}/${ProjName}.bin"
"${PROJECT_BUILD_DIR}/${ProjName}_ti.bin"



Technical Support and Product Updates[edit]

The support and comunity for Sitara Processors is at http://www.ti.com/lsds/ti/arm/sitara_arm_cortex_a_processor/support.page The Sitara E2E forum is at http://e2e.ti.com/support/arm/sitara_arm/default.aspx






E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article SYSBIOS Industrial SDK 02.01.00.01 User Guide here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity