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.

AWR2944EVM: 传感器论坛

Part Number: AWR2944EVM


工程师你好,

最近在使用AWR2944EVM,使用EVM的OOB中的enetStream demo时遇到了如下问题。希望可以帮忙解答,非常感谢

1.在使用visualizer发送。cfg文件时,可以正常配置以太网,并可以从tcpserver.py中读取到数据。

2.通过CLI_ByPassApi()函数配置以太网参数时,会出现问题,如图1所示,在配置完以太网的remoteIp之后,板子就无响应了,(图中表示为done只打印了don),

图1

图2为radarcmdString中的配置信息

图2

3.我确认localIP已经被正确配置,连接方式为EVM-router-PC,router具有DHCP功能,通过queryLocalIP得到LocalIP的地址为172.168.4.207,remoteIp为172.168.4.195

#ifndef CLI_BYPASS
#define CLI_BYPASS
static void CLI_task(void* args)
{
    #ifndef CLI_BYPASS
    uint8_t                 cmdString[READ_LINE_BUFSIZE];
    char*                   tokenizedArgs[CLI_MAX_ARGS];
    char*                   ptrCLICommand;
    char                    delimitter[] = " \r\n";
    uint32_t                argIndex;
    CLI_CmdTableEntry*      ptrCLICommandEntry;
    int32_t                 cliStatus, status;
    uint32_t                index;

    /* Do we have a banner to be displayed? */
    if (gCLI.cfg.cliBanner != NULL)
    {
        /* YES: Display the banner */
        CLI_write (gCLI.cfg.cliBanner);
    }
        CLI_write("CLI_task\n");
        while(1)
        {
            if(enet_init_flag)
            {
            CLI_write("get localIp\n");
            break;
            }
        }
    /* Loop around forever: */
    while (1)
    {
        /* Demo Prompt: */
        CLI_write (gCLI.cfg.cliPrompt);

        /* Reset the command string: */
        memset ((void *)&cmdString[0], 0, sizeof(cmdString));
        
        status = CLI_readLine(gCLI.cfg.cliUartHandle, (char*)&cmdString[0], READ_LINE_BUFSIZE);
        if(status != SystemP_SUCCESS)
        {
            CLI_write("Error reading\n");
        }

        /* Reset all the tokenized arguments: */
        memset ((void *)&tokenizedArgs, 0, sizeof(tokenizedArgs));
        argIndex      = 0;
        ptrCLICommand = (char*)&cmdString[0];

        /* comment lines found - ignore the whole line*/
        if (cmdString[0]=='%' || cmdString[1]=='%')
        {
            CLI_write ("Skipped\n");
            continue;
        }

        /* Set the CLI status: */
        cliStatus = -1;

        /* The command has been entered we now tokenize the command message */
        while (1)
        {
            /* Tokenize the arguments: */
            tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter);
            if (tokenizedArgs[argIndex] == NULL)
                break;

            /* Increment the argument index: */
            argIndex++;
            if (argIndex >= CLI_MAX_ARGS)
                break;

            /* Reset the command string */
            ptrCLICommand = NULL;
        }

        /* Were we able to tokenize the CLI command? */
        if (argIndex == 0)
            continue;

        /* Cycle through all the registered CLI commands: */
        for (index = 0; index < gCLI.numCLICommands; index++)
        {
            ptrCLICommandEntry = &gCLI.cfg.tableEntry[index];

            /* Do we have a match? */
            if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0)
            {
                /* YES: Pass this to the CLI registered function */
                cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
                if (cliStatus == 0)
                {
                    CLI_write ("Done\r\n");
                }
                else
                {
                    CLI_write ("Error %d\r\n", cliStatus);
                }
                break;
            }
        }

        /* Did we get a matching CLI command? */
        if (index == gCLI.numCLICommands)
        {
            /* NO matching command found. Is the mmWave extension enabled? */
            if (gCLI.cfg.enableMMWaveExtension == 1U)
            {
                /* Yes: Pass this to the mmWave extension handler */
                cliStatus = CLI_MMWaveExtensionHandler (argIndex, tokenizedArgs);
            }

            /* Was the CLI command found? */
            if (cliStatus == -1)
            {
                /* No: The command was still not found */
                CLI_write ("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]);
            }
        }
    }
    #else
    CLI_write("BYPASS_API\n");
    if(enet_init_flag)
    CLI_write("LocalIp have  been set\n");
	CLI_ByPassApi(&gCLI.cfg);
    CLI_write("LocalIp SET\n");
#endif
}
#endif

  • 你好,

    你能否添加一些打印,看看在使用cli bypass发送网络配置的时候,enetTask里的网络初始化相关代码是否已经完成?

  • 你好,请问你指的初始化是哪些参数的初始化,我试过用全局变量来判断LocalIp的初始化是否完成,代码中的enet_init_flag就是那个全局变量

  • 你好,

    就是enetTask里while之前的代码。

    你也可以连上CCS单步调试看看配置网络后挂在了什么地方。

  • 你好,请问是在tcpclient_thread里面等待数据包的那个while循环吗,如上面的图1所示,在配置完以太网的remoteIP之后,成功的打印出了remoteIP但在这之后的极短时间内板子就无响应了。在MmwDemo_CLIEnetCfg(int32_t argc, char* argv[]),这个函数里面,发送了信号量SemaphoreP_post(&gMmwMssMCB.enetCfg.EnetCfgDoneSemHandle);  在tcpclient_thread中接收信号量,我尝试过注释掉发送信号量,板子不会失去响应。请问,问题出在接受信号量之前还是在接收信号量之后。

  • 你好,

    建议添加一些delay的时间,看看是否有帮助。

  • 你好,我也想到了这一点。从板子上电到拿上位机发送配置文件之前,有一段时间可以用于各初始化函数,而直接使用

    CLI_ByPassApi函数可能没有时间初始化。所以我在调用CLI_ByPassApi函数之前加了
     ClockP_usleep(2000000);但是在完成以太网的配置后,板子还是失去响应了,在tcpserver.py上也没有显示connected,我在执行完CLI_ByPassApi函数,以及在tcpclient_thread中接收到信号量之后加了log,但是均没有打印出来
        #else
        ClockP_usleep(2000000);
        CLI_write("BYPASS_API\n");
        if(enet_init_flag&&if_localIp_set)
        CLI_write("LocalIp have  been set\n");
        //CLI_write("my_err=%d\r\n",my_err);
    	CLI_ByPassApi(&gCLI.cfg);
        CLI_write("LocalIp SET\n");
        
        
        //tcpclient_thread
          netconn_bind(conn, IP_ADDR_ANY, 7);
      if_localIp_set = true;
    #endif /* LWIP_IPV6 */
      LWIP_ERROR("tcpecho: invalid conn", (conn != NULL), return;);
      CLI_write("tcpclient_thread\r\n");
    
      SemaphoreP_pend(&gMmwMssMCB.enetCfg.EnetCfgDoneSemHandle, SystemP_WAIT_FOREVER);
      CLI_write("Enet Semaphore Posted !!\r\n");
      printf("Enet Semaphore Posted !!\n");
      const ip_addr_t test_local_ip = gMmwMssMCB.enetCfg.remoteIp; 
      //const ip_addr_t test_local_ip = (ip_addr_t) IPADDR4_INIT_BYTES(remoteIp[0],remoteIp[1],remoteIp[2],remoteIp[3]); 
      CLI_write("test local ip set\r\n");
      err = netconn_connect(conn, &test_local_ip ,7);
      CLI_write("err=%d\r\n",err);
      if (err != ERR_OK){
        printf("netconn connect has failed !!\n");
      }
  • 发送了信号量SemaphoreP_post(&gMmwMssMCB.enetCfg.EnetCfgDoneSemHandle); 

    能否在发送信号量前,添加delay? 例如Task_Sleep(1000) //1s

  • 你好

    我没有找到关于Task_Sleep的声明和定义,使用的延时函数是ClockP_usleep,请问二者有什么区别吗

  • 你好,

    Task_Sleep是bios的函数,可以停止当前任务。以太网任务的优先级比较低,可以用这个试试。

    更多信息请参考下面文档:

    module ti.sysbios.knl.Task

  • 你好,

    我在MmwDemo_CLIEnetCfg()中remoteIP配置结束后,加了一段延时,现在程序可以跳到tcpclient_thread中等待信号量之后执行,执行的结果为返回一个错误代码err=-4,我看了一下是Routing problem,现在使用的连接方式是EVM-交换机-PC,但是通过上位机VISUALIZER发送配置文件可以成功配置以太网,我不清楚是交换机的问题,还是代码的问题。您觉得呢?

    if (pcb->netif_idx != NETIF_NO_INDEX) {
        netif = netif_get_by_index(pcb->netif_idx);
      } else {
        /* check if we have a route to the remote host */
        netif = ip_route(&pcb->local_ip, &pcb->remote_ip);
      }
      if (netif == NULL) {
        /* Don't even try to send a SYN packet if we have no route since that will fail. */
        return ERR_RTE;
      }

  • 你好

    我在创建CLI_Task前面加了一段延时函数,现在可以从网口读取到数据了,但是发现天线可能没有被正确的配置,使用tcpserver.py读到的数据如下图