This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM623: How to do a MAC loopback test with CPSW in AM62x devices

Part Number: AM623


Hi, TI expert! 

I have a development environment for am6234, with our own evaluation board.

The software SDK version is PROCESSOR-SDK-LINUX-RT-AM62X-08.06.00.42.

Refer to the post in the link below. If we want to perform an Ethernet MAC loopback test on am62x in Linux using the shell script in the referenced link, how should we modify the MAC register address in the shell script?

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1203408/faq-tda4vm-how-to-do-a-mac-loopback-test-with-cpsw-in-tda4-dra8-devices/4537821?tisearch=e2e-sitesearch&keymatch=phy%252520loopback%252520test#4537821

#!/bin/bash

my_ip_addr=192.168.1.46
server_ip_addr=192.168.1.100

# this mac addr is for TDA4/DRA8 devices, 
# for am62x devices, what value it should be set to ??
mac_addr=0x0C023330  
IF_NAME=eth2

echo "======= $IF_NAME stats ======="
ethtool -S $IF_NAME | grep good

echo "**************************"
echo "Setting CPSW in Loopback"
echo "**************************"

var=$(( 16#$(devmem2 $mac_addr | tail -n1 -c9) ))
devmem2 $mac_addr w `expr $var + 2`
devmem2 $mac_addr

echo ""
echo "Running Ping ..."
ping -c 5 $server_ip_addr
echo ""

echo "======= $IF_NAME stats ======="
ethtool -S $IF_NAME | grep good

echo "**************************"
echo "Removing CPSW Loopback"
echo "**************************"

devmem2 $mac_addr w $var

Regards,

Li

  • Hi Li,

    I have assigned the query to the subject matter expert. Please expect delayed response as the expert is currently out of office & will return next week.

    Thanks for your patience.

    Regards,

    Prashant

  • Hi Li,

    Until the subject matter expert is back in office I will offer some information that I found.

    Based on the FAQ in your referenced link, the main register used was "CPSW_PN_MAC_CONTROL_REG" (0x0C022330 + formula) to configure MAC loopback mode for TDA4/DRV8 devices.

    For AM62x devices, this register is named "CPSW_NU_CPSW_NU_CPSW_NU_ETH_MAC_0_PN_MAC_CONTROL_REG" for MAC 0 (address 0x08022330) or "CPSW_NU_CPSW_NU_CPSW_NU_ETH_MAC_1_PN_MAC_CONTROL_REG" for MAC 1 (address 0x08023330). This information can be found in the Technical Reference Manual on page 11740 and 11798. 

    Similar to the FAQ for TDA4/DRV8 devices, bit 1 in the register most likely needs to be set in order to enable loopback mode. I assume the bash script sets bit 1 in line 19 to enable loopback. Assuming this is correct and that there are no other differences between TDA4/DRV8 and AM62x devices for this register, I believe that the $mac_addr could be changed to 0x08022330 or 0x08023330 depending on which MAC port you wanted to perform the loopback test on. 

    Please note that I have not tested this on my own but it might be something you can try out. Please let me know if it works.

    Best regards,

    Daolin