AM64x MCU+ SDK  08.02.00
Enet ICSSG Time Aware Shaper (EST) Example

Introduction

This example demonstrates Time-Aware Shaper functionality on ICSSG Switch and Dual-MAC peripherals.

On AM64X, we can do ethernet based communication using ICSSG HW Mechanism

  • PRU firmware based Ethernet Switch and Dual MAC implementation
  • This HW can be used with industrial communication protocols as well (see Industrial Communications Toolkit)

This example do below:

  • Target-side application running on a Cortex R5F core.
    • One TX channel and one RX flow are opened for each available MAC port.
    • The application has a menu to start the TAS test and to Print or Reset the Statistics. This menu along with application logs are implemented via UART.
  • Host-side functionality
    • Wireshark can be used to receive and verify packet contents.

Below shows the configuration used for the Time Aware Shaper which is used to configure each MAC port in AM64xx device.

|<------------- Cycle time = 250 us --------------->|
+------------+------------+------------+------------+
| | | | |
+------------+------------+------------+------------+
|<---------->|<---------->|<---------->|<---------->|
Window index 0 1 2 3
Duration 62.5 us 62.5 us 62.5 us 62.5 us
Gate mask 0b00000011 0b00001100 0b00110000 0b11000000
  • The default cycle time is set to be 250us and each window is equally divided in the cycle as shown above.
  • The startTasTest test case configures each of the MAC ports with the above-mentioned configuration and transmits 2 packets each with traffic class values varying from 0 to 7.
  • As per the TAS configuration the packets with traffic class of 0 and 1 will only be transmitted within the time duration of window index 0, traffic class 2 and 3 will be transmitted in window index 1 and so on.
  • The startTasTest test case verifies if all the packets transmitted have their tx timestamp within their corresponding windows. If this condition is satisfied then test is marked as passed.
  • The test is repeated for all ports with link up.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0_freertos
Toolchain ti-arm-clang
Board am64x-evm
Icssg Instance ICSSG1
Example folder examples/networking/enet_icssg_tas

Steps to Run the Example

Build the example

  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)

HW Setup

Note
Make sure you have setup the EVM with cable connections as shown here, EVM Setup. In addition do below steps.

AM64X-EVM

For ICSSG based example

  • Connect two ethernet cables to the EVM from two host PC's as shown below

Ethernet cable for ICSS based ethernet

Run the example

Attention
If you need to reload and run again, a CPU power-cycle is MUST
  • Launch a CCS debug session and run the example executable, see CCS Launch, Load and Run
  • You will see logs in the UART terminal as shown in the next section.
  • Wait until the interface MAC ID is assigned and printed on the console and select the test case

Sample output for ICSSG TAS example

Note
"EnetMod_ioctl: icssgx-x.tas: Failed to do IOCTL cmd 0x01000b0x: 1" This is not a ioctl failure but ioctl is returned with status as inprogress as it is Asynchronous ioctl.
==========================
ENET ICSSG TAS TEST
==========================
Init Enet's OSAL and utils to use defaults
Init memory utils
Create clock and task for periodic tick
Create periodic tick task
Create periodic tick clock
Open Main UDMA driver
Init all peripheral clocks
----------------------------------------------
Enabling clocks!
Init all configs
----------------------------------------------
icssg1: init config
Open all peripherals
----------------------------------------------
icssg1: Open enet
icssg1: Register async IOCTL callback
icssg1: Register TX timestamp callback
Attach core id 1 on all peripherals
----------------------------------------------
icssg1: Attach core
Create RX tasks
----------------------------------------------
icssg1: Create RX task
icssg1: Open port 1
icssg1: Open port 1 link
EnetPhy_bindDriver: PHY 15: OUI:080028 Model:0f Ver:01 <-> 'dp83869' : OK
icssg1: Open port 2
icssg1: Open port 2 link
EnetPhy_bindDriver: PHY 3: OUI:080028 Model:0f Ver:01 <-> 'dp83869' : OK
icssg1: Waiting for link up...
Enet Multiport Menu:
'T' - Start the TAS test with default config
's' - Print statistics
'r' - Reset statistics
'x' - Stop the test
Icssg_handleLinkUp: icssg1: Port 2: Link up: 1-Gbps Full-Duplex
Icssg_handleLinkUp: icssg1: Port 1: Link up: 1-Gbps Full-Duplex
icssg1: Port 1 link is up
icssg1: Set port state to 'Forward'
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
icssg1: Port 2 link is up
icssg1: Set port state to 'Forward'
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
icssg1: Open DMA
initQs() txFreePktInfoQ initialized with 8 pkts
icssg1: Set MAC addr: 70:ff:76:1d:92:c1
icssg1: MAC port addr: 70:ff:76:1d:92:c1
Invalid option, try again...
Enet Multiport Menu:
'T' - Start the TAS test with default config
's' - Print statistics
'r' - Reset statistics
'x' - Stop the test
T
Success: IOCTL command sent for making MAC entry in FDB
icssg1: Async IOCTL completed
Success: IOCTL command sent for making MAC entry in FDB
icssg1: Async IOCTL completed
EnetMod_ioctl: icssg1-1.tas: Failed to do IOCTL cmd 0x01000b03: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
EnetMod_ioctl: icssg1-1.tas: Failed to do IOCTL cmd 0x01000b01: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
EnetMod_ioctl: icssg1-1.tas: Failed to do IOCTL cmd 0x01000b03: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
Transmitting 16 packets
Packet 0 is within window timestamp : 3352 window_start : 0 window_end : 62500
Packet 1 is within window timestamp : 932 window_start : 0 window_end : 62500
Packet 2 is within window timestamp : 65588 window_start : 62500 window_end : 125000
Packet 3 is within window timestamp : 63164 window_start : 62500 window_end : 125000
Packet 4 is within window timestamp : 128060 window_start : 125000 window_end : 187500
Packet 5 is within window timestamp : 125620 window_start : 125000 window_end : 187500
Packet 6 is within window timestamp : 230044 window_start : 187500 window_end : 250000
Packet 7 is within window timestamp : 238076 window_start : 187500 window_end : 250000
Packet 8 is within window timestamp : 4556 window_start : 0 window_end : 62500
Packet 9 is within window timestamp : 2124 window_start : 0 window_end : 62500
Packet 10 is within window timestamp : 66788 window_start : 62500 window_end : 125000
Packet 11 is within window timestamp : 64356 window_start : 62500 window_end : 125000
Packet 12 is within window timestamp : 129252 window_start : 125000 window_end : 187500
Packet 13 is within window timestamp : 126812 window_start : 125000 window_end : 187500
Packet 14 is within window timestamp : 189412 window_start : 187500 window_end : 250000
Packet 15 is within window timestamp : 188220 window_start : 187500 window_end : 250000
Enet TAS Test PASSED
EnetMod_ioctl: icssg1-2.tas: Failed to do IOCTL cmd 0x01000b03: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
EnetMod_ioctl: icssg1-2.tas: Failed to do IOCTL cmd 0x01000b01: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
EnetMod_ioctl: icssg1-2.tas: Failed to do IOCTL cmd 0x01000b03: 1
icssg1: Async IOCTL completed
icssg1: Async IOCTL completed
Transmitting 16 packets
Packet 0 is within window timestamp : 56900 window_start : 0 window_end : 62500
Packet 1 is within window timestamp : 1048 window_start : 0 window_end : 62500
Packet 2 is within window timestamp : 70244 window_start : 62500 window_end : 125000
Packet 3 is within window timestamp : 74636 window_start : 62500 window_end : 125000
Packet 4 is within window timestamp : 126860 window_start : 125000 window_end : 187500
Packet 5 is within window timestamp : 125664 window_start : 125000 window_end : 187500
Packet 6 is within window timestamp : 190516 window_start : 187500 window_end : 250000
Packet 7 is within window timestamp : 188088 window_start : 187500 window_end : 250000
Packet 8 is within window timestamp : 3472 window_start : 0 window_end : 62500
Packet 9 is within window timestamp : 2244 window_start : 0 window_end : 62500
Packet 10 is within window timestamp : 118308 window_start : 62500 window_end : 125000
Packet 11 is within window timestamp : 122340 window_start : 62500 window_end : 125000
Packet 12 is within window timestamp : 130280 window_start : 125000 window_end : 187500
Packet 13 is within window timestamp : 134284 window_start : 125000 window_end : 187500
Packet 14 is within window timestamp : 191716 window_start : 187500 window_end : 250000
Packet 15 is within window timestamp : 189284 window_start : 187500 window_end : 250000
Enet TAS Test PASSED

See Also

Enet Time Aware Shaper Networking