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.

TDA4VM: [TDA4] KSZ9031 compatibility problems between SDK 7.3 & SDK 8.2

Part Number: TDA4VM

Dear Expert :

We have two version customized board for TDA4 :

* Version A : J721E SR1.0 SoC + SDK 7.3 --> CPSW2G+ ksz9031 PHY works well

* Version B : J721E SR1.1 SoC + SDK 8.2 --> CPSW2G+ ksz9031 PHY works fail

ksz9031 sheet as below :

https://www.microchip.com/en-us/product/KSZ9031

 

Version A and Version B have the same schematic design on ethernet PHY KSZ9031

so I try to find out this problem, steps as below :

1. Check standard register for KSZ9031:

I set network speed mandatory on 100Mbps, and cheeck standard register 2

Everything seems ok, and KSZ9031 detect link status correctly!

command "ping" failure!!

NOTICE:  BL31: v2.5(release):08.01.00.006-dirty
NOTICE:  BL31: Built : 21:03:57, Mar 23 2022

U-Boot SPL 2021.01-gec08cd44-dirty (Jul 05 2022 - 18:46:25 +0800)
Model: Texas Instruments K3 J721E SoC
EEPROM not available at 0x50, trying to read at 0x51
Reading on-board EEPROM at 0x51 failed 1
Board: J721EX-PM1-SOM rev E2
SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
EEPROM not available at 0x50, trying to read at 0x51
Reading on-board EEPROM at 0x51 failed 1
Trying to boot from MMC2


U-Boot 2021.01-gec08cd44-dirty (Jul 05 2022 - 18:46:25 +0800)

SoC:   J721E SR1.1
Model: Texas Instruments K3 J721E SoC
EEPROM not available at 0x50, trying to read at 0x51
Reading on-board EEPROM at 0x51 failed 1
Board: J721EX-PM1-SOM rev E2
DRAM:  4 GiB
Flash: 0 Bytes
MMC:   sdhci@4f80000: 0, sdhci@4fb0000: 1
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
am65_cpsw_nuss ethernet@46000000: K3 CPSW: nuss_ver: 0x6BA00101 cpsw_ver: 0x6BA80100 ale_ver: 0x00293904 Ports:1 mdio_freq:1000000
EEPROM not available at 0x50, trying to read at 0x51
Reading on-board EEPROM at 0x51 failed 1
Net:   Enter phy_micrel_ksz90x1_init
am65_cpsw_nuss_port ethernet@46000000port@1: Port 1 speed froced to 100Mbit
Enter ksz9031_config
Enter ksz9031_of_config
ksz9031_of_config, ARRAY_SIZE(ofcfg) = 4
Enter ksz90x1_of_config_group
ksz90x1_of_config_group: ofcfg->grpsz = 2
ksz90x1_of_config_group, ofcfg->grp[0].name = txen-skew-ps, val[0] = -1
ksz90x1_of_config_group, ofcfg->grp[1].name = rxdv-skew-ps, val[1] = -1
Enter ksz90x1_of_config_group
ksz90x1_of_config_group: ofcfg->grpsz = 4
ksz90x1_of_config_group, ofcfg->grp[0].name = rxd0-skew-ps, val[0] = -1
ksz90x1_of_config_group, ofcfg->grp[1].name = rxd1-skew-ps, val[1] = -1
ksz90x1_of_config_group, ofcfg->grp[2].name = rxd2-skew-ps, val[2] = -1
ksz90x1_of_config_group, ofcfg->grp[3].name = rxd3-skew-ps, val[3] = -1
Enter ksz90x1_of_config_group
ksz90x1_of_config_group: ofcfg->grpsz = 4
ksz90x1_of_config_group, ofcfg->grp[0].name = txd0-skew-ps, val[0] = -1
ksz90x1_of_config_group, ofcfg->grp[1].name = txd1-skew-ps, val[1] = -1
ksz90x1_of_config_group, ofcfg->grp[2].name = txd2-skew-ps, val[2] = -1
ksz90x1_of_config_group, ofcfg->grp[3].name = txd3-skew-ps, val[3] = -1
Enter ksz90x1_of_config_group
ksz90x1_of_config_group: ofcfg->grpsz = 2
ksz90x1_of_config_group, ofcfg->grp[0].name = rxc-skew-ps, val[0] = -1
ksz90x1_of_config_group, ofcfg->grp[1].name = txc-skew-ps, val[1] = -1
Enter ksz9031_center_flp_timing
Enter ksz9031_phy_extwrite
Enter ksz9031_phy_extended_write
Enter ksz9031_phy_extwrite
Enter ksz9031_phy_extended_write
eth0: ethernet@46000000port@1
Hit any key to stop autoboot:  0
=>
=> mdio list
ethernet@46000000port@1:
0 - Micrel ksz9031 <--> ethernet@46000000port@1
=> mii read 0 0
1140
=> mii read 0 1
796D
=> mii read 0 2
0022
=> mii read 0 3
1622
=> mii read 0 4
01E1
=> mii read 0 5
45E1
=> mii read 0 6
0007
=> mii read 0 7
2001
=> mii read 0 8
0000
=> mii read 0 9
0000
=> mii read 0 a
4000
=> mii read 0 d
8000
=> mii read 0 e
06A4
=> mii read 0 f
3000
=> mii read 0 11
00F4
=> mii read 0 12
0000
=> mii read 0 13
0079
=> mii read 0 15
0000
=> mii read 0 1b
0029
=> mii read 0 1c
0000
=> mii read 0 1f
0328
=> mii dump 0 0
0.     (1140)                 -- PHY control register --
  (8000:0000) 0.15    =     0     reset
  (4000:0000) 0.14    =     0     loopback
  (2040:0040) 0. 6,13 =   b10    speed selection = 1000 Mbps
  (1000:1000) 0.12    =     1     A/N enable
  (0800:0000) 0.11    =     0     power-down
  (0400:0000) 0.10    =     0     isolate
  (0200:0000) 0. 9    =     0     restart A/N
  (0100:0100) 0. 8    =     1     duplex = full
  (0080:0000) 0. 7    =     0     collision test enable
  (003f:0000) 0. 5- 0 =     0     (reserved)


=> mii dump 0 1
1.     (796d)                 -- PHY status register --
  (8000:0000) 1.15    =     0     100BASE-T4 able
  (4000:4000) 1.14    =     1     100BASE-X  full duplex able
  (2000:2000) 1.13    =     1     100BASE-X  half duplex able
  (1000:1000) 1.12    =     1     10 Mbps    full duplex able
  (0800:0800) 1.11    =     1     10 Mbps    half duplex able
  (0400:0000) 1.10    =     0     100BASE-T2 full duplex able
  (0200:0000) 1. 9    =     0     100BASE-T2 half duplex able
  (0100:0100) 1. 8    =     1     extended status
  (0080:0000) 1. 7    =     0     (reserved)
  (0040:0040) 1. 6    =     1     MF preamble suppression
  (0020:0020) 1. 5    =     1     A/N complete
  (0010:0000) 1. 4    =     0     remote fault
  (0008:0008) 1. 3    =     1     A/N able
  (0004:0004) 1. 2    =     1     link status
  (0002:0000) 1. 1    =     0     jabber detect
  (0001:0001) 1. 0    =     1     extended capabilities


=> mii dump 0 2
2.     (0022)                 -- PHY ID 1 register --
  (ffff:0022) 2.15- 0 =    34     OUI portion


=> mii dump 0 3
3.     (1622)                 -- PHY ID 2 register --
  (fc00:1400) 3.15-10 =     5     OUI portion
  (03f0:0220) 3. 9- 4 =    34     manufacturer part number
  (000f:0002) 3. 3- 0 =     2     manufacturer rev. number


=> mii dump 0 4
4.     (01e1)                 -- Autonegotiation advertisement register --
  (8000:0000) 4.15    =     0     next page able
  (4000:0000) 4.14    =     0     (reserved)
  (2000:0000) 4.13    =     0     remote fault
  (1000:0000) 4.12    =     0     (reserved)
  (0800:0000) 4.11    =     0     asymmetric pause
  (0400:0000) 4.10    =     0     pause enable
  (0200:0000) 4. 9    =     0     100BASE-T4 able
  (0100:0100) 4. 8    =     1     100BASE-TX full duplex able
  (0080:0080) 4. 7    =     1     100BASE-TX able
  (0040:0040) 4. 6    =     1     10BASE-T   full duplex able
  (0020:0020) 4. 5    =     1     10BASE-T   able
  (001f:0001) 4. 4- 0 =     1     selector = IEEE 802.3 CSMA/CD


=> mii dump 0 5
5.     (45e1)                 -- Autonegotiation partner abilities register --
  (8000:0000) 5.15    =     0     next page able
  (4000:4000) 5.14    =     1     acknowledge
  (2000:0000) 5.13    =     0     remote fault
  (1000:0000) 5.12    =     0     (reserved)
  (0800:0000) 5.11    =     0     asymmetric pause able
  (0400:0400) 5.10    =     1     pause able
  (0200:0000) 5. 9    =     0     100BASE-T4 able
  (0100:0100) 5. 8    =     1     100BASE-X full duplex able
  (0080:0080) 5. 7    =     1     100BASE-TX able
  (0040:0040) 5. 6    =     1     10BASE-T full duplex able
  (0020:0020) 5. 5    =     1     10BASE-T able
  (001f:0001) 5. 4- 0 =     1     partner selector = IEEE 802.3 CSMA/CD


=> mii dump 0 9
9.     (0000)                 -- 1000BASE-T control register --
  (e000:0000) 9.15-13 =     0     test mode
  (1000:0000) 9.12    =     0     manual master/slave enable
  (0800:0000) 9.11    =     0     manual master/slave value
  (0400:0000) 9.10    =     0     multi/single port
  (0200:0000) 9. 9    =     0     1000BASE-T full duplex able
  (0100:0000) 9. 8    =     0     1000BASE-T half duplex able
  (0080:0000) 9. 7    =     0     automatic TDR on link down
  (1fc0:0000) 9. 6    =     0     (reserved)


=> mii dump 0 a
10.     (4000)                 -- 1000BASE-T status register --
  (8000:0000) 10.15    =     0    master/slave config fault
  (4000:4000) 10.14    =     1    master/slave config result
  (2000:0000) 10.13    =     0    local receiver status OK
  (1000:0000) 10.12    =     0    remote receiver status OK
  (0800:0000) 10.11    =     0    1000BASE-T full duplex able
  (0400:0000) 10.10    =     0    1000BASE-T half duplex able
  (0300:0000) 10. 9- 8 =     0    (reserved)
  (00ff:0000) 10. 7- 0 =     0    1000BASE-T idle error counter


=> env default -a
## Resetting to default environment
=> saveenv
Saving Environment to FAT... OK
=> setenv autoload no
=> setenv serverip 192.168.11.1
=> setenv ipaddr 192.168.11.230
=> setenv gatewayip 192.168.11.1
=> setenv netmask 255.255.255.0
=> setenv ethaddr 00:13:96:00:11:22
=> saveenv
Saving Environment to FAT... OK
=> ping 192.168.11.1
k3-navss-ringacc ringacc@2b800000: Ring Accelerator probed rings:286, gp-rings[96,20] sci-dev-id:235
k3-navss-ringacc ringacc@2b800000: dma-ring-reset-quirk: disabled
am65_cpsw_nuss_port ethernet@46000000port@1: K3 CPSW: rflow_id_base: 2
Enter ksz90xx_startup
ksz90xx_startup:DUPLEX_FULL
ksz90xx_startup:SPEED_100Mbps
link up on port 1, speed 100, full duplex
Using ethernet@46000000port@1 device

ARP Retry count exceeded; starting again
ping failed; host 192.168.11.1 is not alive
=>

2. Check device tree in u-boot

\board-support\u-boot-2021.01+gitAUTOINC+44a87e3ab8-g44a87e3ab8\arch\arm\dts\k3-j721e-common-proc-board.dts

	mcu_cpsw_pins_default: mcu-cpsw-pins-default {
		pinctrl-single,pins = <
			J721E_WKUP_IOPAD(0x0058, PIN_OUTPUT, 0) /* MCU_RGMII1_TX_CTL */
			J721E_WKUP_IOPAD(0x005c, PIN_INPUT, 0) /* MCU_RGMII1_RX_CTL */
			J721E_WKUP_IOPAD(0x0060, PIN_OUTPUT, 0) /* MCU_RGMII1_TD3 */
			J721E_WKUP_IOPAD(0x0064, PIN_OUTPUT, 0) /* MCU_RGMII1_TD2 */
			J721E_WKUP_IOPAD(0x0068, PIN_OUTPUT, 0) /* MCU_RGMII1_TD1 */
			J721E_WKUP_IOPAD(0x006c, PIN_OUTPUT, 0) /* MCU_RGMII1_TD0 */
			J721E_WKUP_IOPAD(0x0078, PIN_INPUT, 0) /* MCU_RGMII1_RD3 */
			J721E_WKUP_IOPAD(0x007c, PIN_INPUT, 0) /* MCU_RGMII1_RD2 */
			J721E_WKUP_IOPAD(0x0080, PIN_INPUT, 0) /* MCU_RGMII1_RD1 */
			J721E_WKUP_IOPAD(0x0084, PIN_INPUT, 0) /* MCU_RGMII1_RD0 */
			J721E_WKUP_IOPAD(0x0070, PIN_OUTPUT, 0) /* MCU_RGMII1_TXC */
			J721E_WKUP_IOPAD(0x0074, PIN_INPUT, 0) /* MCU_RGMII1_RXC */
		>;
	};

&mcu_cpsw {
	pinctrl-names = "default";
	pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
};

&davinci_mdio {
	phy0: ethernet-phy@0 {
		reg = <0>;
		max-speed = <100>;

	};
};

&cpsw_port1 {

	status = "okay";
	/* DP PHY */
	//phy-mode = "rgmii-rxid";
	phy-handle = <&phy0>;
	max-speed = <100>;
	
};

3. Check Skew delay for KSZ9031

I use default value, because this setting works fine for Version A board

it should be also works fine for Version B board  over speed 100Mbps

 

=> mii read 0 0
1140
=> mii write 0 d 0x0002
=> mii write 0 e 0x0004
=> mii write 0 d 0x4002
=> mii read 0 e
0071
=> mii write 0 d 0x0002
=> mii write 0 e 0x0005
=> mii write 0 d 0x4002
=> mii read 0 e
7777
=> mii write 0 d 0x0002
=> mii write 0 e 0x0006
=> mii write 0 d 0x4002
=> mii read 0 e
1111
=> mii write 0 d 0x0002
=> mii write 0 e 0x0008
=> mii write 0 d 0x4002
=> mii read 0 e
3DF9

4. Set static IP for testing

mount ksz9031 driver successfuly, and set static ip for "ping" test .

The result show no response.

\root@j7-evm:~# dmesg | grep LSZ9031
root@j7-evm:~# dmesg | grep KSZ9031
[    1.461668] davinci_mdio 46000f00.mdio: phy[0]: device 46000f00.mdio:00, driver Micrel KSZ9031 Gigabit PHY
[    2.357675] davinci_mdio 46000f00.mdio: phy[0]: device 46000f00.mdio:00, driver Micrel KSZ9031 Gigabit PHY
[   10.452251] Micrel KSZ9031 Gigabit PHY 46000f00.mdio:00: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=46000f00.mdio:00, irq=POLL)
root@j7-evm:~# ifconfig eth0 192.168.11.22 netmask 255.255.255.0
root@j7-evm:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.11.22  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 fe80::2676:25ff:fe99:7f18  prefixlen 64  scopeid 0x20<link>
        ether 24:76:25:99:7f:18  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 39  bytes 6628 (6.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 82  bytes 6220 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 82  bytes 6220 (6.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@j7-evm:~# ping 192.168.11.1
PING 192.168.11.1 (192.168.11.1): 56 data bytes
[  131.504618] Initializing XFRM netlink socket
[  135.925935] process 'docker/tmp/qemu-check916837770/check' started with executable stack

4. Check register in TDA4

Now let's check related register in TDA4

everything seems fine ... 

===============================
             Menu
===============================
0: Clear Stats : CPSW 2G
3: Print Stats : CPSW 2G
6: Print ALE : CPSW 2G
9: Print Enet CFG : CPSW 2G
12: Verify Enet Ctrl CFG : CPSW 2G
15: Print MAC Config : CPSW 2G
20: CPSW2G Others
Make your choice : 20

Address 0x46000000 CPSW2G CPSW_SS_CPSW_NUSS_IDVER_REG 0x6ba00101
Address 0x46000004 CPSW2G CPSW_SS_SYNCE_COUNT_REG 0x0
Address 0x46000008 CPSW2G CPSW_SS_SYNCE_MUX_REG 0x0
Address 0x4600000c CPSW2G CPSW_SS_CONTROL_REG 0x0
#Address 0x46000018 CPSW2G CPSW_SS_RGMII_STATUS_REG 0x0
Address 0x4600001c CPSW2G CPSW_SS_SUBSSYSTEM_STATUS_REG 0x0
Address 0x40f04040 CPSW2G MCU_CPSW0_NUSS_SS 0x2

5. Check CPSW2G port0 / port1 status 

The result let you know, something wrong !!

port 0 only get RX FRAME, strange!!

port 1 only get TX FRAME, strange!!

--------------------------------
          PORT0 STATS
--------------------------------
STAT_0_RXGOODFRAMES              = 11e mem:0x4603a000
STAT_0_RXBROADCASTFRAMES         = fb mem:0x4603a004
STAT_0_RXMULTICASTFRAMES         = 23 mem:0x4603a008
STAT_0_RXOCTETS                  = 5fc0 mem:0x4603a030
STAT_0_OCTETFRAMES64             = ed mem:0x4603a068
STAT_0_OCTETFRAMES65T127         = 16 mem:0x4603a06c
STAT_0_OCTETFRAMES128T255        = d mem:0x4603a070
STAT_0_OCTETFRAMES256T511        = e mem:0x4603a074
STAT_0_NETOCTETS                 = 5fc0 mem:0x4603a080
--------------------------------
          PORT1 STATS
--------------------------------
STAT_1_TXGOODFRAMES              = 11e mem:0x4603a234
STAT_1_TXBROADCASTFRAMES         = fb mem:0x4603a238
STAT_1_TXMULTICASTFRAMES         = 23 mem:0x4603a23c
STAT_1_TXOCTETS                  = 5fc0 mem:0x4603a264
STAT_1_OCTETFRAMES64             = ed mem:0x4603a268
STAT_1_OCTETFRAMES65T127         = 16 mem:0x4603a26c
STAT_1_OCTETFRAMES128T255        = d mem:0x4603a270
STAT_1_OCTETFRAMES256T511        = e mem:0x4603a274
STAT_1_NETOCTETS                 = 5fc0 mem:0x4603a280
STAT_1_TX_PRI_REG             [0]= 11e
STAT_1_TX_PRI_BCNT_REG        [0]= 5fc0
===============================
             Menu
===============================
0: Clear Stats : CPSW 2G
3: Print Stats : CPSW 2G
6: Print ALE : CPSW 2G
9: Print Enet CFG : CPSW 2G
12: Verify Enet Ctrl CFG : CPSW 2G
15: Print MAC Config : CPSW 2G
20: CPSW2G Others

it should be some problems over RGMII interface

Does anyone has good comment for debugging on tda4 side?

Thanks very much

Gibbs

 

  • Hi Gibbs,

    Does anyone has good comment for debugging on tda4 side?

    You can compare the Phy and CPSW registers between SDK 7.3 and SDK 8.2. 

    port 0 only get RX FRAME, strange!!

    port 1 only get TX FRAME, strange!!

    This means that the CPSW is not receiving any traffic from the Phy. Port 0 is the Host port of CPSW while Port 1 is the port where the Phy is connected. So, port 0 will receive the packets from A72 and forward them to Port 1 which will send it to the Phy. So what the statistic register means is that the CPSW has transmitted the packet  to phy. You can try enabling Phy loopback and trying the experiment once again. See the Port 1 Rx good frames for any frames received by CPSW. They should be same as Port 1 Tx good frames.

    Regards,
    Tanmay

  • Hi, Tanmay :

    Thanks your reply.

    I set phy in loopback mode and test again.  result as below

    1. this show you link status is ok  in loop back mode, basic register 1, bit2 = 1

    root@j7-evm:~# phytool read eth0/0/1
    0x794d

    2. CPSW register value in loopback mode

    --------------------------------
              PORT0 STATS
    --------------------------------
    STAT_0_RXGOODFRAMES              = 27
    STAT_0_RXBROADCASTFRAMES         = f
    STAT_0_RXMULTICASTFRAMES         = 18
    STAT_0_RXOCTETS                  = 1eba
    STAT_0_OCTETFRAMES65T127         = 11
    STAT_0_OCTETFRAMES128T255        = 7
    STAT_0_OCTETFRAMES256T511        = f
    STAT_0_NETOCTETS                 = 1eba
    --------------------------------
              PORT1 STATS
    --------------------------------
    STAT_1_TXGOODFRAMES              = 27
    STAT_1_TXBROADCASTFRAMES         = f
    STAT_1_TXMULTICASTFRAMES         = 18
    STAT_1_TXOCTETS                  = 1eba
    STAT_1_OCTETFRAMES65T127         = 11
    STAT_1_OCTETFRAMES128T255        = 7
    STAT_1_OCTETFRAMES256T511        = f
    STAT_1_NETOCTETS                 = 1eba
    STAT_1_TX_PRI_REG             [0]= 27
    STAT_1_TX_PRI_BCNT_REG        [0]= 1eba

    base on your mention before...

    >> port 0 will receive the packets from A72 and forward them to Port 1 which will send it to the Phy.

    so the meaning is : port0 receiver frame from host, and then forwarding to port1 tx, that's why we only see port 0 "rx" have good framem port 1 "tx" have good frame?

    If loopback mode is still failure, what can I do for next steps?

    because I need to clarify ths issuse is ON tda4 side or on KSZ9031 side?

    Thanks very much

    Gibbs :)

  • Hi,

    By Phy loopback, I meant enable phy loopback and see the statistics when you send a packet. Ideally, it should increment 3 stats. STAT_0_RXGOODFRAMES, STAT_1_TXGOODFRAMES and STAT_1_RXGOODFRAMES. Are you able to see increment in STAT_1_RXGOODFRAMES?

    This would differentiate between CPSW issue or phy issue. If you see increment in STAT_1_RXGOODFRAMES, that means that Phy is able to forward the packets to CPSW and issue is in CPSW. If not, then the issue is in Phy.

    Regards,
    Tanmay

  • Hi, Tanmay 

    Thanks your reply.

    After few test, today

    my status as below 

    (1). even I set ksz9031 in digital loopback, STAT_1_TXGOODFRAMES has increment data, but STAT_1_RXGOODFRAMES is not

    (2) base previous item 1, I use oscilloscope to capture hardware singal,  both rgmii TX and RX line have no singal.

    is it possible to repeat stuff ethernet frame data  (like patern :0xFFFF) in digital loop back?

    because I need to compare TX & RX frame in digital loopback, it can help us do more advance debug on 9031

    Do you have any sample code?

    Many Thanks

    Gibbs

  • Hi Gibbs,

    STAT_1_TXGOODFRAMES has increment data, but STAT_1_RXGOODFRAMES is not

    (2) base previous item 1, I use oscilloscope to capture hardware singal,  both rgmii TX and RX line have no singal.

    It is weird that you do not have any rgmii Tx signal as the TX GOODFRAMES stat is increasing. Can you recheck the probe point.

    is it possible to repeat stuff ethernet frame data  (like patern :0xFFFF) in digital loop back?

    It is possible to pad the data with a 16 bit pattern with -p flag in ping. If you increase the packet size, you will be able to see it clearly on oscilloscope. You can set size with -s flag in ping. I have used this command in the attached script.

    Attachment : https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/eth_5F00_stas_5F00_ping.sh

    Can you run the attached script (eth_stats_ping.sh) and post the result here.

    You will have to change my_ip_addr and server_ip_addr based on your setup in the script.

    Regards,
    Tanmay

  • Thanks Tanmay,

    after few day debugging, we solved this problems yesterday

    This is a hardware issue on our customized board

    I think this thread may be a guide for phy chip debugging, and I will use you script test again.

    if it possible, I may post the test result here later 

    Gibbs

  • if normal, result as below ..

    root@j7-evm:~# ./eth_stas_ping.sh
    ======= eth0 stats =======
         p0_rx_good_frames: 118
         p0_tx_good_frames: 83
         rx_good_frames: 87
         tx_good_frames: 118
    
    Running Ping ...
    PING 192.168.11.1 (192.168.11.1): 504 data bytes
    512 bytes from 192.168.11.1: seq=0 ttl=64 time=0.848 ms
    512 bytes from 192.168.11.1: seq=1 ttl=64 time=0.796 ms
    512 bytes from 192.168.11.1: seq=2 ttl=64 time=0.782 ms
    512 bytes from 192.168.11.1: seq=3 ttl=64 time=0.806 ms
    512 bytes from 192.168.11.1: seq=4 ttl=64 time=0.843 ms
    512 bytes from 192.168.11.1: seq=5 ttl=64 time=0.805 ms
    512 bytes from 192.168.11.1: seq=6 ttl=64 time=0.747 ms
    512 bytes from 192.168.11.1: seq=7 ttl=64 time=0.779 ms
    512 bytes from 192.168.11.1: seq=8 ttl=64 time=0.769 ms
    512 bytes from 192.168.11.1: seq=9 ttl=64 time=0.756 ms
    
    --- 192.168.11.1 ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 0.747/0.793/0.848 ms
    
    ======= eth0 stats =======
         p0_rx_good_frames: 129
         p0_tx_good_frames: 93
         rx_good_frames: 97
         tx_good_frames: 129
    **************************
    Setting CPSW2G in Loopback
    **************************
    /dev/mem opened.
    Memory mapped at address 0xffff8ef40000.
    Read at address  0x46022330 (0xffff8ef42330): 0x00000021
    Write at address 0x46022330 (0xffff8ef42330): 0x00000023, readback 0x00000023
    ======= eth0 stats =======
         p0_rx_good_frames: 129
         p0_tx_good_frames: 93
         rx_good_frames: 97
         tx_good_frames: 129
    
    Running Ping ...
    PING 192.168.11.1 (192.168.11.1): 504 data bytes
    
    --- 192.168.11.1 ping statistics ---
    10 packets transmitted, 0 packets received, 100% packet loss
    
    ======= eth0 stats =======
         p0_rx_good_frames: 143
         p0_tx_good_frames: 93
         rx_good_frames: 97
         tx_good_frames: 143
    **************************
    Removing CPSW2G Loopback
    **************************
    /dev/mem opened.
    Memory mapped at address 0xffff9e0c0000.
    Read at address  0x46022330 (0xffff9e0c2330): 0x00000023
    Write at address 0x46022330 (0xffff9e0c2330): 0x00000021, readback 0x00000021

  • Hi Gibbs, 

    As a part of loopback test (the second ping command), the rx_good_frames should also increase as loopback is enabled.

    I observed the device-tree snippet you attached in the question and I am wondering why are you commenting out the phy-mode attribute in the cpsw_port1 node?

    Can you try the script again once after mentioning your interface in the phy-mode command. For the available interfaces, you can see phy-connection-type in Documentation/devicetree/bindings/net/ethernet-controller.yaml.

    Also, the max-speed property is not implemented in cpsw driver. But that should not be an issue if it is implemented in phy driver as it will then set the link to 100M.

    Regards,
    Tanmay

  • Hi, Tanmay 

    >> I observed the device-tree snippet you attached in the question and I am wondering why are you commenting out the phy-mode attribute in the cpsw_port1 node?

    Your reminder give me some hints, because I just face a problems. 

    "u-boot networking fail, but linux netorking fine". because there are some code different between u-boot device tree and linux device tree

    for example, "phy-mode" property added in my linux kernel device tree, but u-boot is not! , linux code show as below

    I will check it again later

    follow your comment, I do the test again...

    1. set phy works in loopback mode

    'root@j7-evm:~# phytool write eth0/0/0 0x6100
    root@j7-evm:~# [  102.854172] am65-cpsw-nuss 46000000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
    [  102.862883] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    
    root@j7-evm:~# phytool write eth0/0/9 0x1000
    root@j7-evm:~#

    2. check register

    root@j7-evm:~# ./cpsw-test
    ===============================
                 Menu
    ===============================
    0: Clear Stats : CPSW 2G
    3: Print Stats : CPSW 2G
    6: Print ALE : CPSW 2G
    9: Print Enet CFG : CPSW 2G
    12: Verify Enet Ctrl CFG : CPSW 2G
    15: Print MAC Config : CPSW 2G
    20: CPSW2G Others
    Make your choice : 3
              STATS
    --------------------------------
              PORT0 STATS
    --------------------------------
    STAT_0_RXGOODFRAMES              = 1c
    STAT_0_RXBROADCASTFRAMES         = 7
    STAT_0_RXMULTICASTFRAMES         = 15
    STAT_0_RXOCTETS                  = 136c
    STAT_0_OCTETFRAMES65T127         = e
    STAT_0_OCTETFRAMES128T255        = 7
    STAT_0_OCTETFRAMES256T511        = 7
    STAT_0_NETOCTETS                 = 136c
    --------------------------------
              PORT1 STATS
    --------------------------------
    STAT_1_RXGOODFRAMES              = 1c
    STAT_1_RXBROADCASTFRAMES         = 7
    STAT_1_RXMULTICASTFRAMES         = 15
    STAT_1_ALE_DROP                  = 1c
    STAT_1_RXOCTETS                  = 136c
    STAT_1_TXGOODFRAMES              = 1c
    STAT_1_TXBROADCASTFRAMES         = 7
    STAT_1_TXMULTICASTFRAMES         = 15
    STAT_1_TXOCTETS                  = 136c
    STAT_1_OCTETFRAMES65T127         = 1c
    STAT_1_OCTETFRAMES128T255        = e
    STAT_1_OCTETFRAMES256T511        = e
    STAT_1_NETOCTETS                 = 26d8
    STAT_1_PORTMASK_DROP             = 1c
    STAT_1_ALE_SECURE_DROP           = 1c
    STAT_1_TX_PRI_REG             [0]= 1c
    STAT_1_TX_PRI_BCNT_REG        [0]= 136c
    ===============================
                 Menu
    ===============================

    3. because close loop, set server/client as the same address

    root@j7-evm:~# ifconfig eth0 192.168.11.8 netmask 255.255.255.0
    root@j7-evm:~# ifconfig
    docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500  metric 1
            inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
            ether 02:42:87:6e:34:a0  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
            inet 192.168.11.8  netmask 255.255.255.0  broadcast 192.168.11.255
            inet6 fe80::2676:25ff:fe99:7f18  prefixlen 64  scopeid 0x20<link>
            ether 24:76:25:99:7f:18  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 40  bytes 6791 (6.6 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536  metric 1
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 82  bytes 6220 (6.0 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 82  bytes 6220 (6.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    4. run script.

    root@j7-evm:~# ./eth_stas_ping.sh
    ======= eth0 stats =======
         p0_rx_good_frames: 42
         p0_tx_good_frames: 0
         rx_good_frames: 42
         tx_good_frames: 42
    
    Running Ping ...
    PING 192.168.11.8 (192.168.11.8): 504 data bytes
    512 bytes from 192.168.11.8: seq=0 ttl=64 time=0.125 ms
    512 bytes from 192.168.11.8: seq=1 ttl=64 time=0.096 ms
    512 bytes from 192.168.11.8: seq=2 ttl=64 time=0.092 ms
    512 bytes from 192.168.11.8: seq=3 ttl=64 time=0.093 ms
    512 bytes from 192.168.11.8: seq=4 ttl=64 time=0.094 ms
    512 bytes from 192.168.11.8: seq=5 ttl=64 time=0.091 ms
    512 bytes from 192.168.11.8: seq=6 ttl=64 time=0.095 ms
    512 bytes from 192.168.11.8: seq=7 ttl=64 time=0.090 ms
    512 bytes from 192.168.11.8: seq=8 ttl=64 time=0.095 ms
    512 bytes from 192.168.11.8: seq=9 ttl=64 time=0.101 ms
    
    --- 192.168.11.8 ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 0.090/0.097/0.125 ms
    
    ======= eth0 stats =======
         p0_rx_good_frames: 42
         p0_tx_good_frames: 0
         rx_good_frames: 42
         tx_good_frames: 42
    **************************
    Setting CPSW2G in Loopback
    **************************
    /dev/mem opened.
    Memory mapped at address 0xffffa2100000.
    Read at address  0x46022330 (0xffffa2102330): 0x00000021
    Write at address 0x46022330 (0xffffa2102330): 0x00000023, readback 0x00000023
    ======= eth0 stats =======
         p0_rx_good_frames: 42
         p0_tx_good_frames: 0
         rx_good_frames: 42
         tx_good_frames: 42
    
    Running Ping ...
    PING 192.168.11.8 (192.168.11.8): 504 data bytes
    512 bytes from 192.168.11.8: seq=0 ttl=64 time=0.122 ms
    512 bytes from 192.168.11.8: seq=1 ttl=64 time=0.094 ms
    512 bytes from 192.168.11.8: seq=2 ttl=64 time=0.092 ms
    512 bytes from 192.168.11.8: seq=3 ttl=64 time=0.105 ms
    512 bytes from 192.168.11.8: seq=4 ttl=64 time=0.092 ms
    512 bytes from 192.168.11.8: seq=5 ttl=64 time=0.094 ms
    512 bytes from 192.168.11.8: seq=6 ttl=64 time=0.091 ms
    512 bytes from 192.168.11.8: seq=7 ttl=64 time=0.090 ms
    512 bytes from 192.168.11.8: seq=8 ttl=64 time=0.090 ms
    512 bytes from 192.168.11.8: seq=9 ttl=64 time=0.099 ms
    
    --- 192.168.11.8 ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 0.090/0.096/0.122 ms
    
    ======= eth0 stats =======
         p0_rx_good_frames: 42
         p0_tx_good_frames: 0
         rx_good_frames: 42
         tx_good_frames: 42
    **************************
    Removing CPSW2G Loopback
    **************************
    /dev/mem opened.
    Memory mapped at address 0xffffa7d60000.
    Read at address  0x46022330 (0xffffa7d62330): 0x00000023
    Write at address 0x46022330 (0xffffa7d62330): 0x00000021, readback 0x00000021

    Gibbs

  • Hi Gibbs,

    Sorry for the delayed response.

    Is the issue still observed?

    Regards,
    Tanmay

  • Hi, Tanmay :

    Problems sloved, Thanks you help

    Gibbs