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.

RTOS: RTOS|AM4378 Does NDK support three ehternet interface(both cpsw gigabit port and pru-icss ethernet)?

Tool/software: TI-RTOS

Basic Infomation:
Board:Base IDKAM437x
PDK:ti-processor-sdk-rtos-am437x-evm-03.01.00.06-Windows-x86
NDK:ndk_2_24_03_35


Hi TI Expert:

My application need to use the three ethernet port(both cpsw gigabit port and pru-icss ethernet),and I try to combine NIMU_Basic_Example and NIMU_ICSS_BasicExample project,the three ehternet port has been assigned seperate subway IP-Address ,and the command "ping xx.xx.xx.xx" works fine。
But when I use DaemonNew function to create TCP connection(just simple tcp echo),it could not establish TCP connection 。 But when i only use the two pru-icss ethernet port,the tcp connection is ok and tcp echo works fine。

Here are some code:

ICSS-EMAC Port 1 initializations

 emacHandle1 = (ICSS_EmacHandle)malloc(sizeof(ICSS_EmacConfig));
 switchEmacCfg1 = (ICSS_EmacInitConfig*)malloc(sizeof(ICSS_EmacInitConfig)); 
 switchEmacCfg1->phyAddr[0]=0;
 switchEmacCfg1->phyAddr[1]=0;
 switchEmacCfg1->portMask = ICSS_EMAC_MODE_MAC1;
 switchEmacCfg1->ethPrioQueue = ICSS_EMAC_QUEUE1;
 switchEmacCfg1->halfDuplexEnable = 1;
 switchEmacCfg1->enableIntrPacing = ICSS_EMAC_ENABLE_PACING;
 switchEmacCfg1->ICSS_EmacIntrPacingMode = ICSS_EMAC_INTR_PACING_MODE1;
 switchEmacCfg1->pacingThreshold = 100;
 switchEmacCfg1->learningEn = 0;
 switchEmacCfg1->rxIntNum = 52;   //PRU_ICSS1_EVTOUT0
 switchEmacCfg1->linkIntNum=58;  //PRU_ICSS1_EVTOUT6
 SOCCtrlGetPortMacAddr(1,MacAddr1); //获取MAC地址
 switchEmacCfg1->macId = MacAddr1;
 ICSSEmacDRVInit(emacHandle1, 1); 
 ((ICSS_EmacObject*)emacHandle1->object)->pruIcssHandle = pruIcssHandle;
 ((ICSS_EmacObject*)emacHandle1->object)->emacInitcfg = switchEmacCfg1; 

 PRUICSS_IntcInitData pruss_intc_initdata = PRUSS_INTC_INITDATA;
 ICSS_EmacInit(emacHandle1,&pruss_intc_initdata,ICSS_EMAC_MODE_MAC1|ICSS_EMAC_MODE_DUALMAC); 

 Task_Params taskParams;
 Task_Params_init(&taskParams);
 taskParams.priority = 10;
 taskParams.instance->name = (char*)"port1_rxTaskFnc";
 taskParams.stackSize = 0x1000;
 taskParams.arg0 = (UArg)emacHandle1;
 ((ICSS_EmacObject*)emacHandle1->object)->rxTaskHandle = Task_create(ICSS_EMacOsRxTaskFnc, &taskParams, NULL);

ICSS-EMAC PORT2 Initializations

emacHandle2 = (ICSS_EmacHandle)malloc(sizeof(ICSS_EmacConfig));
switchEmacCfg2 = (ICSS_EmacInitConfig*)malloc(sizeof(ICSS_EmacInitConfig)); 
switchEmacCfg2->phyAddr[0]= 1;
switchEmacCfg2->phyAddr[1]= 0;
switchEmacCfg2->portMask = ICSS_EMAC_MODE_MAC2;
switchEmacCfg2->ethPrioQueue = ICSS_EMAC_QUEUE3;
switchEmacCfg2->halfDuplexEnable = 1;
switchEmacCfg2->enableIntrPacing = ICSS_EMAC_DISABLE_PACING;
switchEmacCfg2->pacingThreshold = 100;
switchEmacCfg2->learningEn = 0;
switchEmacCfg2->rxIntNum = 53;  //PRU_ICSS1_EVTOUT1
switchEmacCfg2->linkIntNum=59; //PRU_ICSS1_EVTOUT7
SOCCtrlGetPortMacAddr(2,MacAddr2); 
switchEmacCfg2->macId = MacAddr2;
ICSSEmacDRVInit(emacHandle2,1); 
((ICSS_EmacObject*)emacHandle2->object)->pruIcssHandle = pruIcssHandle;
((ICSS_EmacObject*)emacHandle2->object)->emacInitcfg = switchEmacCfg2; 

PRUICSS_IntcInitData pruss_intc_initdata = PRUSS_INTC_INITDATA;
ICSS_EmacInit(emacHandle2,&pruss_intc_initdata,ICSS_EMAC_MODE_MAC2|ICSS_EMAC_MODE_DUALMAC); 

Task_Params taskParams;
Task_Params_init(&taskParams);
taskParams.priority = 10;
taskParams.instance->name = (char*)"port2_rxTaskFnc";
taskParams.stackSize = 0x1000;
taskParams.arg0 = (UArg)emacHandle2;
((ICSS_EmacObject*)emacHandle2->object)->rxTaskHandle = Task_create(ICSS_EMacOsRxTaskFnc, &taskParams, NULL);

NetifEntry and NIMUDeviceTable code

OSDRV_addNetifEntry((NIMUInitFn)&EmacInit,emacHandle1);   //PRU-ETH0
OSDRV_addNetifEntry((NIMUInitFn)&EmacInit,emacHandle2);  //PRU-ETH1
OSDRV_addNetifEntry((NIMUInitFn)&CpswEmacInit,0);  //CPSW

My question is :
1、Does NDK support three ehternet Port(both cpsw gigabit port and pru-icss ethernet)?
2、Or is there something wrong with my code?How should I do to solve the problem?

Please help me,many thanks!

dcount107 2019.4.12

  • Hi,

    We have dual EMAC examples but not 3 EMAC ports. The NDK should be able to support 3 Ethernet ports. Some customer tried to integrate ICSS and CPSW together, please check this E2E if it helps: e2e.ti.com/.../2883725.

    Regards, Eric
  • Hi Eric,Thank you and sorry for the late reply.
    I had readed this post before,and here is my Board_Init code:

    Board_initCfg cfg = BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO | BOARD_INIT_PINMUX_CONFIG;// | BOARD_INIT_ICSS_PINMUX;

    SDKMMUInit();
    // Board_pinMuxConfig(am437xIdkMux);
    Board_init(cfg);
    PINMUXModuleConfig(CHIPDB_MOD_ID_CPSW, 0U, NULL);
    PINMUXModuleConfig(CHIPDB_MOD_ID_PRU_ICSS, 0U, NULL);
    PINMUXModuleConfig(CHIPDB_MOD_ID_PRU_ICSS, 1U, NULL);

    But the post mentioned “so you need to remove the ‘idkAM437x_icssPinMuxFlag’ in the board library and rebuild”,I dont know how to do it,can you help me?

    Regard.
  • Hi Eric,
    I had found the "idkAM437x_icssPinMuxFlag" in the board library source file "idkAM437x_pinmux.c",the effect of remove the ‘idkAM437x_icssPinMuxFlag’ is the same as my code。Besides,the ping xx.xx.xx.xx for all the three port works fine,so I dont think the problem is the PINMUX。
    Regards。
  • Hi,

    Can you confirm that in your code, the below are called:

    PINMUXModuleConfig(CHIPDB_MOD_ID_CPSW, 0U, NULL);
    PINMUXModuleConfig(CHIPDB_MOD_ID_PRU_ICSS, 1U, NULL);

    For the TCP echo server, do you follow the www.ti.com/.../spru524j.pdf, section 5.4.2 Server Daemon Example? "This code allows up to three echo sessions to be running simultaneously on different threads. Note the IP
    specified is NULL, allowing echo connection on any local IP address assigned to the system."

    For the three networks, how do you test the TCP connection to AM437x? Are they the same way?

    In the working case, what do you mean with two ICSS ports, how do you disable the CPSW port? Do you have a Wireshark capture for the TCP connection?

    If you only enable the CPSW port but disable the two ICSS, will TCP connection worked? Do you have the failure case Wireshark capture?

    Regards, Eric
  • Hi,Eric

    If i only enable CPSW port but disable the two ICSS, the TCP connection failed。
    So I compared the NIMU_BasicExample and NIMU_ICSS_BasicExample project file,I had found there are some difference in .cfg File.
    In the NIMU_ICSS_BasicExample project BIOS.heapSize is seted as 0x10000;
    And in the NIMU_BasicExample project BIOS.heapSize is seted as 0xA0000;
    When I modify the BIOS.heapSize to 0xA0000,all the TCP connection works fine.

    Thanks.