TI中文支持网
TI专业的中文技术问题搜集分享网站

RTOS|AM437x 多网口(CPSW和PRU-ICSS)NDK TCP通讯问题

TI专家好。

我有个项目需要同时用到AM437x的CPSW网口(千兆)和两个PRU-ICSS网口(100M,当做普通网口使用),目前我已经根据NIMU_BasicExample和NIMU_ICSS_BasicExample两个例程合并修改,现已实现三个网口的配置和IP地址分配,每个网口单独均可ping通,但是现在有一个比较奇怪的现象,还请各位专家多多指教。

PRU-ICSS1网口配置代码如下

/*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_EVTOUT0switchEmacCfg1->linkIntNum=58;  //PRU_ICSS1_EVTOUT6SOCCtrlGetPortMacAddr(1,MacAddr1); //获取MAC地址switchEmacCfg1->macId = MacAddr1;ICSSEmacDRVInit(emacHandle1, 1);((ICSS_EmacObject*)emacHandle1->object)->pruIcssHandle = pruIcssHandle;((ICSS_EmacObject*)emacHandle1->object)->emacInitcfg = switchEmacCfg1;//中断及EMAC模式配置PRUICSS_IntcInitData pruss_intc_initdata = PRUSS_INTC_INITDATA;ICSS_EmacInit(emacHandle1,&pruss_intc_initdata,ICSS_EMAC_MODE_MAC1|ICSS_EMAC_MODE_DUALMAC);//创建Rx接收事件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);

PRU-ICSS2网口配置代码如下:

/*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_EVTOUT1switchEmacCfg2->linkIntNum=59; //PRU_ICSS1_EVTOUT7SOCCtrlGetPortMacAddr(2,MacAddr2); //获取MAC地址switchEmacCfg2->macId = MacAddr2;ICSSEmacDRVInit(emacHandle2,1);((ICSS_EmacObject*)emacHandle2->object)->pruIcssHandle = pruIcssHandle;((ICSS_EmacObject*)emacHandle2->object)->emacInitcfg = switchEmacCfg2;//中断及EMAC模式配置PRUICSS_IntcInitData pruss_intc_initdata = PRUSS_INTC_INITDATA;ICSS_EmacInit(emacHandle2,&pruss_intc_initdata,ICSS_EMAC_MODE_MAC2|ICSS_EMAC_MODE_DUALMAC);//创建Rx接收事件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);

三个网口与NIMUDeviceTable对应关系如下:

//设置NIMUDeviceTable入口
OSDRV_addNetifEntry((NIMUInitFn)&EmacInit,emacHandle1);   //PRU-ETH0
OSDRV_addNetifEntry((NIMUInitFn)&EmacInit,emacHandle2);  //PRU-ETH1
OSDRV_addNetifEntry((NIMUInitFn)&CpswEmacInit,0);  //CPSW

//TCP

void netOpenHook()

{
// Create our local servers
hEcho = DaemonNew( SOCK_STREAMNC, 0, 502, dtask_tcp_echo,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );

}

问题在于:上述配置完成后,虽然可以ping通,但无法进行TCP通讯,dtask_tcp_echo无任何响应。如果将CPSW入口删除则dtask_tcp_echo执行正常,单独运行NIMU_BasicExample例程也没有问题。

还请TI各位专家帮忙解答,问题出在哪里?应如何查找?

user5885945:

回复 Annie Liu:

感谢您的回复。我已经将问题转到E2E英文技术论坛上,虽然专家没有直接帮我解决问题,但还是提供了一些思路。
最终问题在于BIOS.HeapSize设置问题,放大后工作正常。

yongqing wang:

回复 user5885945:

感谢分享方法

赞(0)
未经允许不得转载:TI中文支持网 » RTOS|AM437x 多网口(CPSW和PRU-ICSS)NDK TCP通讯问题
分享到: 更多 (0)