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.

AM2432: Regarding the issue of the the CPSW Ethernet switch mode

Part Number: AM2432
Other Parts Discussed in Thread: SYSCONFIG

Hi experts,

During the development using the AM2432 chip, our company encountered the following issues regarding the CPSW Ethernet switch mode:

We are utilizing Port 1 and Port 2 of the CPSW, where Port 1 is dedicated to EtherCAT communication and Port 2 is used for the lwIP protocol stack. However, during actual operation, we observed that both ports simultaneously receive both EtherCAT frames and lwIP frames. The reception of lwIP frames on the EtherCAT port adversely affects the number of EtherCAT slaves we can connect.

Therefore, we need to adjust the switch mode of the two CPSW ports to enable independent data transmission and reception on both ports, thereby preventing lwIP frames from interfering with EtherCAT communication.

 

SDK Version: 08_06_00_45
Reference Examples: enet_cpsw_socket, enet_layer2_cpsw

Historical information :

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1351767/am2432-sysconfig-conflicts-when-combining-lwip-and-layer2-example/5191476#5191476

 

Regards,

  • Hi Rowthu,

    can you help priority this issue?

    BR,

    Biao

  • Hi Biao,

    I am going through the details in the linked E2E. 
    Can you please provide more info on the packet observations? I am not exactly able to follow the below statement.

    we observed that both ports simultaneously receive both EtherCAT frames and lwIP frames

    Does this mean you are receiving both LwIP and EtherCAT packets from the same port? Is the network supposed to do it?

    If the expectation is that there should be no switching between the two ports, we need to set the CPSW to MAC only mode, which we can do using SYSCONFIG. If there are different expectations, we can look into it based on your inputs.

    Thanks and regards,
    Teja.

  • Hi Biao,

    Can you please provide these details so that we can understand the requirement and work on this further?

    Regards,
    Teja.

  • Hi Teja,

    customers expectation is no switch between the two ports, they already try to set the dual mac mode via below code, but it seem no use to them.

    BR,

    Biao 

  • Hi Teja,

    We would like to know how to change the Switch mode of cpsw to MAC mode by modifying the SYSCONFIG configuration.The SDK version we are using is 08_06_00_45, and the SYSCONFIG version is 1.18.0.

    Thanks and regards,

    Lan

  • Hello,
    Thank you for your query. The concerned expert is Out of Office due to **TI India** Holiday.
    Please expect a delay in response. We appreciate your patience and understanding.

    Best regards,
    TI E2E Support Team
    ---
    *This is an automated notification.*

  • Hi Teja,

    customer seem already use the mac only mode, attach the syscfg as below, pls have a check, can you help customer fix this issue?

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/908/uniIMMam2434_5F00_r5_5F00_0_5F00_0.syscfg

    BR,

    Biao

  • Hi Biao,

    I would need more details on the exact behavior seen, and the network topology. Can the customer provide the following details?

    Can you please provide more info on the packet observations?
    Does this mean you are receiving both LwIP and EtherCAT packets from the same port? Is the network supposed to do it

    These details will help us understand the network behavior and the corresponding connections. We would then be able to correlate the hardware configuration, and suggest the preferred config to achieve your desired behavior.

    Thanks and regards,
    Teja.

  • Hi Teja,

    I would need more details on the exact behavior seen, and the network topology.

    1. The simple network topology structure of the product application scenario is shown in the following figure.

    Does this mean you are receiving both LwIP and EtherCAT packets from the same port? Is the network supposed to do it?

    2. Yes, on the one hand, the product can receive LwIP and EtherCAT data packets simultaneously from the same port; on the other hand, external devices send network data packets to Port1 and Port2, and the product receives the data packets. But I don't want the network to operate this way. I need to isolate the LwIP and EtherCAT networks.
    I need the rules for sending and receiving network data:
    (1) Port1 is only used for EtherCAT communication; Port2 is only used for lwIP communication.
    (2) When the product sends network data packets: data packets are sent from the port (Port1 or Port2) and will not be forwarded to other ports.
    (3) When the product receives network data packets: according to the classification of the port, it only receives data from the corresponding port, and does not receive network data from other irrelevant ports.

    Can you please provide more info on the packet observations? I am not exactly able to follow the below statement.

    3. When the product runs the program, EtherCAT broadcast data frames will be sent out from Port1 at a 1ms cycle, but Port2 can also receive the data frames. I used Wireshark software to capture some network packets from Port2 and could clearly observe that there were many EtherCAT broadcast data frames. As shown in the following figure.

    4. I tried to set CPSW to only MAC mode, but failed. I need your technical support.

    Thanks and regards,

    Weijian

  • Hi Weijian,

    From the above mentioned behavior, I am suspecting that your application is not sending the packets with the txPortNum populated in the txpktinfo. The application can send the Tx packets with specified destination port, and this will skip the ALE look up completely. Our suggestion will be to populate the txPortNum in your application for corresponding traffic.

    If this is not an option, we would need to enable the NO_LEARN mode for the host port enabled. This will ensure that when undirected packets (packets with txportnum empty) reach CPSW, the broadcast and corresponding multicast packets will not be forwarded to the MAC_ONLY defined ports.

    The no learn field can be found in sysconfig under the section: ALE Config -> ALE Port Config -> Learning Security Config for Host port ->No learning -> Set this to true.

    We highly suggest to use directed send with txPortNum filled in the application level rather than sending directed packets, irrespective of sysconfig fix being added.

    Thanks and regards,
    Teja.

  • Hi Teja,

    Thank you for your technical support. You have already helped me solve half of the problem.

    1. By specifying the port number for the txpktinfo variable, the product now sends EtherCAT broadcast data frames normally and does not forward the data packets to Port 2.

    2. There are still issues with LWIP Socket communication:

      (1) When the product sends Socket data packets outward, Wireshark software can capture these Socket data from either Port1 or Port2.

      (2) When the product receives Socket data packets, sending Socket data to the product from either Port1 or Port2, the product can correctly perform the corresponding functions.

    3. I need the LWIP Socket protocol to communicate only through Port 2 and not forward data to Port1. The actual requirements are as follows:

      (1) Product data transmission: Only sent from Port2.

      (2) Product data reception: Only received from Port2, and Port 1 does not receive Socket data.

    4. After referring to the enet_cpsw_socket example, I wrote the LWIP Socket code. However, I found that the sending port number cannot be set in the LWIP Socket. Does this require modifying the underlying driver code in the SDK? 

      (1) SDK version: mcu_plus_sdk_am243x_08_06_00_45

    5. I hope you can help me solve the LWIP Socket communication issue of the product. I need your technical support.

    Thanks and regards,
    Weijian.

  • Hi Weijian,

    Please refer to the path : $(MCU_PLUS_SDK)/source/networking/.meta/enet_cpsw/templates/enet_lwipif.c.xdt

    Find the function 'LwipifEnetAppCb_getRxMode' at line no: 869, and make the following change.

    Lwip2Enet_RxMode_t LwipifEnetAppCb_getRxMode(Enet_Type enetType, uint32_t instId)
    {
    -    const bool hasSwitchModeEnabled = `(module.getNetifCount(instance) == 1)`;
    +    const bool hasSwitchModeEnabled = false;
        Lwip2Enet_RxMode_t rxMode = Lwip2Enet_RxMode_SwitchSharedChannel;
        if (hasSwitchModeEnabled)

    This should prevent the packets from being sent to both ports. But this assumes the port number to be port-1 instead of port-2, since you have only one netif open. 

    Alternatively, you can make a change in $(MCU_PLUS_SDK)/source/networking/enet/core/lwipif/src/lwip2enet.c: Lwip2Enet_sendTxPackets() API, to force all LwIP handled packets to only go out via port 2, using the following change:

                    Lwip2Enet_setSGList(pCurrDmaPacket, hPbufPkt, false);
                    pCurrDmaPacket->appPriv    = hPbufPkt;
    -                pCurrDmaPacket->txPortNum  = macPort;
    +                pCurrDmaPacket->txPortNum  = ENET_MAC_PORT_2;
                    pCurrDmaPacket->node.next  = NULL;
                    pCurrDmaPacket->chkSumInfo = LWIPIF_LWIP_getChkSumInfo(hPbufPkt);

    If you only ever want the LwIP stack to send packets via port-2, then I suggest to use the 2nd method. If you would like to have the flexibility, you can use the first method, and swap the macport 1 and 2 connections if your product allows for it.

    Please let us know if you need further details in this. 

    Thanks and regards,
    Teja.

  • Hi Teja,

     Lwip2Enet_sendTxPackets() API, to force all LwIP handled packets to only go out via port 2

    Thank you for your technical guidance, which has successfully solved my problem.

    Thanks and regards,
    Weijian.