TICS100MOD-SDK  2026.0.0
TICS100MOD-SDK
Loading...
Searching...
No Matches
FreeRTOS Host AM261x-LP Example

This example shows how to build and run a FreeRTOS-based ICS host application on the AM261x-LP, connected over SPI to a TICS100MOD target. It supports EtherCAT, EtherNet/IP, and PROFINET, with one build configuration per protocol.

Before starting, complete the Quick Start Guide and flash the protocol firmware for your chosen protocol onto the target, as described in the Configurator guide.

Overview

am261-main-app is a CCS-based ICS host application for the AM261x-LP platform. In the installed TICS100MOD SDK, the project is located under:

<TICS_SDK_INSTALL_DIR>\examples\ics-host\freertos-r5\am261-main-app

Import this folder into Code Composer Studio (CCS). The imported project is named ics-host-app-am261-freertos.

Item Details
Host AM261x-LP
Target TICS100MOD
Host-target interface SPI0 plus GPIO handshake and reset lines
Operating system FreeRTOS (R5F)
Protocols EtherCAT, EtherNet/IP, PROFINET
Project name ics-host-app-am261-freertos

Prerequisites

Item Details
Hardware AM261x-LP, TICS100MOD (Carrier Board and ICS Development Board), 8 jumper wires, industrial network controller
Software CCS, MCU+ SDK AM261X 26.0.0.06, SysConfig 1.27.0, TI Arm Clang 4.0.4.LTS
Target firmware Firmware for the chosen protocol, flashed as described in the Quick Start Guide
Controller software TwinCAT (EtherCAT), a PROFINET controller or tool (PROFINET), or an EtherNet/IP scanner (EtherNet/IP)

Install the listed products and make the MCU+ SDK available in CCS before importing and building the project.

Hardware Setup

Connect the AM261x-LP to the TICS100MOD target with jumper wires according to the table below.

Signal AM261x-LP pin (host) TICS100MOD pin (target) Wiring Color Code
CLOCK J1.7 SPI0_CLK Blue
MOSI J2.15 SPI0_D0 Red
MISO J2.14 SPI0_D1 Green
TARGET REQUEST FEED J2.19 SPI0_CS Yellow
TARGET BUSY J6.53 GPIO8 Orange
TARGET REQUEST J8.78 GPIO14 Purple
TARGET RESET J8.77 PORZ_HOST Grey
GND - - Black
AM261x-LP to TICS100MOD host interface connections
Warning
Power off both boards before changing any wiring.

Build

The project provides one build configuration for each supported protocol:

Configuration Protocol
Debug-ethernetip EtherNet/IP
Debug-profinet PROFINET
Debug-ethercat EtherCAT
  1. Import am261-main-app into CCS.
  2. In Project Explorer, right-click ics-host-app-am261-freertos.
  3. Select Build Configurations -> Set Active and choose the configuration for your protocol.
  4. Select Project -> Build Project.
  5. Verify that the build completes without errors.

Run

  1. Power on the host and target boards.
  2. Make sure the target is running the firmware that matches the selected build configuration.
  3. Connect the Ethernet port of the TICS100MOD target to the industrial network controller (for example, a PLC or TwinCAT PC), directly or through a switch.
  4. Launch a CCS debug session for the AM261x-LP.
  5. Load and run the application.

The controller-side operation for each protocol is described under "Bring the Bus State On" in the next section.

For the AM261x-LP SoC initialization and CCS loading procedure, see the MCU+ SDK CCS Launch, Load and Run guide. To run the host application from flash without CCS, follow the MCU+ SDK Flash a Hello World example guide and select the images generated by your build configuration.

Test the Application

The following tests are common to EtherNet/IP, PROFINET, and EtherCAT:

  • Auto increment variable test
  • Emergency variable test
  • LED test (network to target)
  • T2N test (target to network)

After Ics_start() succeeds, the application registers the read and write callbacks and creates the bus-state monitor, T2N, and LED test threads. The monitor periodically refreshes the BusState reported by the target. The T2N and LED threads perform their cyclic work while the bus state is On (true) and pause while it is Off (false).

The industrial network controller initiates the read and write requests used by the auto increment and emergency tests. The T2N and LED tasks run automatically once the bus state allows cyclic work.

Bring the Bus State On

The target updates the bus state automatically. Use the operation for the selected protocol:

Protocol Controller operation and bus-state behavior
EtherCAT Configure or scan the target in TwinCAT using the supplied ESI file, then bring it to OP (Operational). The target reports On when it enters OP and Off when it leaves OP.
PROFINET Configure the controller using the supplied GSDML and the application's modules and submodules, then start controller communication to establish an Application Relationship (AR) with the target. The AR connection callback sets the bus state On; the disconnection callback sets it Off.
EtherNet/IP Run the host application so that the target's EtherNet/IP adapter initializes. The target sets the bus state On after adapter initialization. For the cyclic tests, also establish an I/O connection from the controller with ForwardOpen, using Output Assembly 0x65 and Input Assembly 0x64. The On flag alone does not establish this cyclic connection.
  1. Keep the host application running with the matching protocol firmware on the target.
  2. Connect the industrial network controller to the target's Ethernet interface and perform the operation listed above.
  3. Run the tests below and verify the controller-visible values and the host LEDs.

Auto Increment Variable Test

Use the read request for the selected protocol:

Protocol Read request
EtherCAT In TwinCAT CoE - Online, read Incr. by read, index 0x2017, subindex 0.
EtherNet/IP Send Get_Attribute_Single to Class 0x70, Instance 0x01, Attribute 0x380.
PROFINET Read record index 4096 for submodule IDS_IOM_MAP in module IDM_IOM_V1. The test variable is the first byte of the record.
  1. From the controller, repeatedly read the variable listed above.
  2. Check that successive reads return an incrementing value. Each read callback increments the value by 1 before returning it to the controller.

Emergency Variable Test

Use the write request for the selected protocol:

Protocol Write request
EtherCAT In TwinCAT CoE - Online, write Emergency message, index 0x200C, subindex 0.
EtherNet/IP Send Set_Attribute_Single to Class 0x70, Instance 0x01, Attribute 0x381.
PROFINET Write record index 4096 for submodule IDS_IM_MAP in module IDM_IM_V1. Put the test value in the first byte of the record.
  1. In CCS, open freertos-app/ics_app.c, set a breakpoint at the start of OnWrite_EmergencyMsg, and resume the host application.
  2. From the controller, write a value such as 101 to the variable listed above.
  3. When the breakpoint is reached, step over IcsObject_get(object, ICS_UINT32(value)) and inspect the local variable value in CCS. It should equal 101. Resume the application.
  4. Repeat with another value and verify that the callback receives the new value.
Note
Emergency output-pin control is disabled in the current AM261x-LP example, so this test validates the write callback and the received value only.

LED Test (Network to Target)

Use the LED output variable for the selected protocol:

Protocol Output variable
EtherCAT TwinCAT RxPDO variable i2c-leds, index 0x2000, subindex 2.
EtherNet/IP First byte of Output Assembly 0x65, mapped to Class 0x70, Instance 0x01, Attribute 0x310.
PROFINET First byte of the four-byte output submodule IDS_TIO4 in module IDM_IOM_V1.
  1. Establish cyclic communication with the controller.
  2. Write 255 (0xFF) to the LED output variable, then write 0.
  3. Check the AM261x-LP industrial LEDs. All eight LEDs should be ON for 255 and OFF for 0.

T2N Test (Target to Network)

Use the input variable for the selected protocol:

Protocol Input variable
EtherCAT TwinCAT TxPDO variable Test Record, SubIndex 4, index 0x2002, subindex 4.
EtherNet/IP First two bytes of Input Assembly 0x64, mapped to Class 0x70, Instance 0x01, Attribute 0x300.
PROFINET Two-byte input submodule IDS_TI2 in module IDM_IOM_V1.
  1. Establish cyclic communication with the controller.
  2. Monitor the input variable listed above.
  3. Verify that the controller receives a changing 16-bit value. While the bus state is On, the host increments and applies this value with a 10 ms delay between iterations.

For controller setup and protocol-specific network operations, see the Linux Host AM64x-EVM example. Its Linux console commands apply only to the Linux host application; use the procedures on this page for the FreeRTOS example.

Limitations

  • The EtherCAT FoE demo is not supported by the am261-main-app host application.