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.

MCU-PLUS-SDK-AM243X: No Tx possible when using PROFINET with ICSS-EMAC in MII Mode

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: DP83826I, SYSCONFIG

Hello TI experts,

as we made a good progress in integrating the DP83826i in our software to use it on our own hardware problems, we experienced problems when using the PROFINET stack with ICSS-EMAC in MII mode (SDK version 08.03.00.18):

We tested the hardware with the enet_icssg_layer2 exmaple and everything seems to work. We also checked the correct behaviour of the PHY<->MII communication using our own firmware with Enet(ICSS) and lwip.

The next step was to test it with the PROFINET stack:

we used the same phy addresses and MII pin configuration than in our Enet(ICSS) + LWIP firmware but there was no sign of a working ethernet communication (we tried the DCP service + there where no LLDP frames sent by the device).

I digged a bit deeper and debugged the icss_emac.c:

  • rxInterruptHandler() was called -> RX was working
  • ICSS_EMAC_txPacket() was called -> RX & packet processing seems to be working but no transmission from the device was visible on Wireshark

I tried to check the behaviour on the EVM again, because I was sure every things was working fine on the EVM - and it was working as expected.

When I checked the Sysconfig of our EVM-based firmware I found out, that on that hardware target there was also "MII" configured, even if there should be a RGMII interface on that hardware.

This was confusing me so I checked the usage of the define ICSS_EMAC_MII_MODE in the ICSS-EMAC code and the follwing snippets in the icss_emac_local.c file Line 818ff & 881ff got my attention:

/* Need this change for tx pin swap in mii mode for AM64x, AM243x and AM263x only*/
if( (((ICSS_EMAC_Attrs *)icssEmacHandle->attrs)->phyToMacInterfaceMode == ICSS_EMAC_MII_MODE) && (((((ICSS_EMAC_Object *)icssEmacHandle->object)->icssRevision) == 0x103) || ((((ICSS_EMAC_Object *)icssEmacHandle->object)->icssRevision) == 0x203)) )
{
    if(ICSS_EMAC_MODE_SWITCH == (((ICSS_EMAC_Attrs *)icssEmacHandle->attrs))->portMask)
    { /*Switch mode*/
        HW_WR_FIELD32((pruicssHwAttrs->miiRtCfgRegBase) + CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0,
                CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0_TX_MUX_SEL0, 0x0);
    }
    else
    {
        HW_WR_FIELD32((pruicssHwAttrs->miiRtCfgRegBase) + CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0,
                CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0_TX_MUX_SEL0, 0x1);
    }
}
else
{
    if(ICSS_EMAC_MODE_SWITCH == (((ICSS_EMAC_Attrs *)icssEmacHandle->attrs))->portMask)
    { /*Switch mode*/
        HW_WR_FIELD32((pruicssHwAttrs->miiRtCfgRegBase) + CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0,
            CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0_TX_MUX_SEL0, 0x1);
    }
    else
    {
        HW_WR_FIELD32((pruicssHwAttrs->miiRtCfgRegBase) + CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0,
            CSL_ICSS_PR1_MII_RT_PR1_MII_RT_CFG_TXCFG0_TX_MUX_SEL0, 0x0);
    }
}

There was some special tx pin swap for mii mode implemented, which could be the cause of the problems. To check this, I reversed the first part of the if clause to check if the phyToMacInterfaceMode is ICSS_EMAC_RGMII_MODE and recompiled the icss_emac libraries.

After the changes I made Ethernet frames were sent as expected.

Could there be any misconfiguration on our side or is the if clause wrong in the SDK?

Best regards

Alex

  • Hi Alex,

    Both the experts who could help on this thread are on vacation this week. Please expect some delays in response.

    Meanwhile, we are checking internally if somebody else can support.

    Regards,

    Prasad

  • Hi Prasad,

    we did some further analysis of the problem at it seems my "workaround" does not really work and it was just a coincidence that we could see some LLDP frames sent out by our device.

    Working with the unmodified version of the SDK we only can get the communication running, if we have a link on both Ethernet ports during startup. I guess the issue is not on the MII communication side as I assumed at first, let my show you our latest observation:

    Our current setting looks like this

    PC <-----> [Port1] <-> Sitara based customer board <-> [Port2] <-----> another "regular" profinet device

    1. If we just connect the PC on Port1 ans let the board start, the can be not seen any lldp frames as well as no response to DCP requests from the PC. Even if we connect another device on Port 2 there is no change in the communication state.
    2. If we keep connected the PC on Port 1 and the other device on Port2 and restart our device we can see LLDP frames on both ports and DCP frames will be handled as expected (at least most of the times we tried it). If we now disconnect the device on port 2 the communication gets also broken on port 1 and there is no way to communicate with the device via Ethernet
    3. Even if we connect the other device on port 2 again, the communication will not get running again

    To get more information about the behaviour I debugged into the ICSS_Emac layer again and set breakpoints to the ICSS_EMAC_txPacketEnqueue() function (in that session I only connected the PC to port 1).

    A look at the statistics shows that there should be sent some packets through that connected port, but there was nothing visibile at wireshark :(

    Is there any place in the software where I can have a closer look to find the reason why these packets get lost?

    Best regards

    Alex

  • Hi Alex,

    Could you please confirm the following:

    1. Is the phy connection on your board same as that of TI evm?

    2. Since you are using DP83826 phy can you let us know which phy register you are using for configuring the phy?

    3. Can you provide the phy dump of first 32 registers (follow below instructions)


    Step-by-step guide
    Launch CCS

    Edit HW_ICSS_MII_MDIO_USERACCESS0 and HW_ICSS_MII_MDIO_USERACCESS1 in  icss_phy_read.gel file   to match register offset in your HW
    Add GEL file using Tools > GEL Files > Load GEL option
    After initializing PHYs and ICSS MDIO (eg:- run EtherCAT, Profinet, or EtherNet/IP application), run the script from Scripts >ICSS_Configuration >PRU_ICSSG_PHY_Reg_Dump (Ignore ICSSG in the name, it works for ICSSM too)


    Regards

    Nilabh A.

  • Hi Nilabh,

    1. no, the PHY connection on our board ist a MII connection instead of the RGMII used on TI evm. We provided the schematics to Aakash via our project share. If we use an ICSSG based software with lwip on our HW platform everything seems to work fine (switch, link-up/down, etc.)

    2. we mainly use the pin-bootstrapping for the PHY in our case. There seems to be no further config via software except of LED config, SW-Reset and PowerMode using our custom-PHY driver implementation.

    3. I used some test software to print out the PHY registers:

    In the "good" case:

    PHY 3 Register Dump (good case with link on both ports and running communication)
    Register 0000 is: 3100
    Register 0001 is: 786D
    Register 0002 is: 2000
    Register 0003 is: A131
    Register 0004 is: 01E1
    Register 0005 is: CDE1
    Register 0006 is: 000F
    Register 0007 is: 2001
    Register 0008 is: 0000
    Register 0009 is: 0000
    Register 000A is: 0100
    Register 000B is: 040B
    Register 000C is: 0000
    Register 000D is: 401F
    Register 000E is: 0004
    Register 000F is: 0000
    Register 0010 is: 4615
    Register 0011 is: 0108
    Register 0012 is: 6400
    Register 0013 is: 2800
    Register 0014 is: 0000
    Register 0015 is: 0000
    Register 0016 is: 0100
    Register 0017 is: 0049
    Register 0018 is: 0480
    Register 0019 is: CC03
    Register 001A is: 0000
    Register 001B is: 007D
    Register 001C is: 05EE
    Register 001D is: 0000
    Register 001E is: 0102
    Register 0467 is: 00CE
    Register 0468 is: 2587

    and also in the bad case:

    PHY 3 Register Dump (bad case, only link on phy 3)
    Register 0000 is: 3100
    Register 0001 is: 7849
    Register 0002 is: 2000
    Register 0003 is: A131
    Register 0004 is: 01E1
    Register 0005 is: 0000
    Register 0006 is: 0004
    Register 0007 is: 2001
    Register 0008 is: 0000
    Register 0009 is: 0000
    Register 000A is: 0100
    Register 000B is: 040B
    Register 000C is: 0000
    Register 000D is: 401F
    Register 000E is: 2587
    Register 000F is: 0080
    Register 0010 is: 4812
    Register 0011 is: 0108
    Register 0012 is: 6000
    Register 0013 is: 0000
    Register 0014 is: 0000
    Register 0015 is: 0000
    Register 0016 is: 0100
    Register 0017 is: 0041
    Register 0018 is: 0480
    Register 0019 is: C003
    Register 001A is: 0000
    Register 001B is: 007D
    Register 001C is: 05EE
    Register 001D is: 0000
    Register 001E is: 0102
    Register 0467 is: 00CE
    Register 0468 is: 2587
    

    I hope the information provided is helpful, if you need more data, my colleagues will provide that next week.

    Best regards

    Alex

  • Thanks Alex for your patience. We have following observations:

    The PHY dump that you shared for the not working case has 10h PHYSTS_Register PHY Status Register link status bit set as 0 (which means link is not up)

    but you had quoted PHY 3 Register Dump (bad case, only link on phy 3) 

    Could you please clarify the above if phy3 is link up or not?

    Can you please check following:

    1. Connect both the ports and try if communication is working or not?

    2. Can you please check if FIFO is getting drained by phy or not(Please check following register content and share, address are mentioned as well)

    Register                                   PRU ICSSG0    PRU ICSSG1 
    MII_RT_TX_FIFO_LEVEL0    3003 2068h      300B 2068h

    MII_RT_TX_FIFO_LEVEL1    3003 206Ch      300B 206Ch

    3. Also please share phy dump while both ports are connected.

    BR

    Nilabh A.

  • Hi Nilabh,

    you are totally right and I'm sorry that we made made a dump from the wrong port.

    "Good" case - both ports connected - ping responding:

    PHY 7 Register Dump
    Register 0000 is: 3100
    Register 0001 is: 786D
    Register 0002 is: 2000
    Register 0003 is: A131
    Register 0004 is: 01E1
    Register 0005 is: CDE1
    Register 0006 is: 000F
    Register 0007 is: 2001
    Register 0008 is: 0000
    Register 0009 is: 0000
    Register 000A is: 0100
    Register 000B is: 040B
    Register 000C is: 0000
    Register 000D is: 401F
    Register 000E is: 0004
    Register 000F is: 0000
    Register 0010 is: 4615
    Register 0011 is: 0108
    Register 0012 is: 6400
    Register 0013 is: 2800
    Register 0014 is: 0000
    Register 0015 is: 0000
    Register 0016 is: 0100
    Register 0017 is: 0049
    Register 0018 is: 0480
    Register 0019 is: CC07
    Register 001A is: 0000
    Register 001B is: 007D
    Register 001C is: 05EE
    Register 001D is: 0000
    Register 001E is: 0102
    Register 0467 is: 00DE
    Register 0468 is: 2187
    PHY 3 Register Dump
    Register 0000 is: 3100
    Register 0001 is: 786D
    Register 0002 is: 2000
    Register 0003 is: A131
    Register 0004 is: 01E1
    Register 0005 is: CDE1
    Register 0006 is: 000F
    Register 0007 is: 2001
    Register 0008 is: 0000
    Register 0009 is: 0000
    Register 000A is: 0100
    Register 000B is: 040B
    Register 000C is: 0000
    Register 000D is: 401F
    Register 000E is: 0004
    Register 000F is: 0000
    Register 0010 is: 0615
    Register 0011 is: 0108
    Register 0012 is: 6400
    Register 0013 is: 2800
    Register 0014 is: 0000
    Register 0015 is: 0000
    Register 0016 is: 0100
    Register 0017 is: 0049
    Register 0018 is: 0480
    Register 0019 is: CC03
    Register 001A is: 0000
    Register 001B is: 007D
    Register 001C is: 05EE
    Register 001D is: 0000
    Register 001E is: 0102
    Register 0467 is: 00CE
    Register 0468 is: 2587

    Bad case - only one port (PHY7) connected - ping not responding

    PHY 7 Register Dump
    Register 0000 is: 3100
    Register 0001 is: 786D
    Register 0002 is: 2000
    Register 0003 is: A131
    Register 0004 is: 01E1
    Register 0005 is: CDE1
    Register 0006 is: 000F
    Register 0007 is: 2001
    Register 0008 is: 0000
    Register 0009 is: 0000
    Register 000A is: 0100
    Register 000B is: 040B
    Register 000C is: 0000
    Register 000D is: 401F
    Register 000E is: 0004
    Register 000F is: 0000
    Register 0010 is: 4615
    Register 0011 is: 0108
    Register 0012 is: 6400
    Register 0013 is: 0000
    Register 0014 is: 0000
    Register 0015 is: 0000
    Register 0016 is: 0100
    Register 0017 is: 0041
    Register 0018 is: 0480
    Register 0019 is: CC07
    Register 001A is: 0000
    Register 001B is: 007D
    Register 001C is: 05EE
    Register 001D is: 0000
    Register 001E is: 0102
    Register 0467 is: 00DE
    Register 0468 is: 2187

    All values are in both cases 0:

  • Hi Sven,

    What is the behavior if you connect just on phy 3.

    Regards

    Nilabh A. 

  • It is not possible to ping the device, the device is not responding to the ping.

  • Thanks Sven,

    Is the good case you mentioned is with Profinet example or enet example, if on Profinet example then on which port do you see packets coming on phy 3/phy7 or both?

    If it is enet example then can you try connecting both ports in profient example also and see if any portis able to do tx.

    BR

    Nilabh A.

  • We're using SDK version 08.03.00.18 with PROFINET Stack Version 02.02.01 (Alpha).

    The packets are being transmitted over the PHY7 port in "good" case.

  • Nilab, its a customer software on our hardware with a phy different to the one from the evm - so no example project at all

  • Hi Sven,

    Can you please update what is the behaviour for profinet case when both the phy are connected?

    BR

    Nilabh A.

  • Hi Nilabh,

    please read the complete E2E entry beginning from the start.  Everything is explained up there.

    Alex also detailed the problem in his first reply.

    Sven

  • Thanks Sven, 

    We were trying to root cause the issue, it seems to be pointing towards mismatch between phy address given in syscfg and the actual hardware configured phy address

    In syscfg screenshot you shared it is configured as:

    phy 0 -> address 7

    phy 1-> address 3

    This behaviour can be explained if actual hardware connection is

    phy0-> address 3

    phy1-> address 7

    1. Can you please check this ?

    2. Also please share ICSSG1 space memory dump (starting from 0000 0000h to 0004 0000h) for the working and non- working scenarios.

    BR

    Nilabh A.

  • Hi Nilabh,

    thank you very much for your help!

    It was indeed the problem that we mixed up the phy addresses.

    After changing the syscfg to the correct values (phy0 -> address 3 and phy1 -> address 7) everything works as expected!

    Best regards,

    Sven