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/TMS320C6657: NDK start problem

Part Number: TMS320C6657
Other Parts Discussed in Thread: TMDSEVM6657

Tool/software: TI-RTOS

Hello, Dear Friends. I have a problem with NDK to my project.

I am using next components:

-> bios_6_73_01_01

-> ndk_3_40_01_01

-> pdk_c665x_2_0_12

-> xdctools_3_51_01_18_core

What am i doing wrong? My code in attachment.

Source code:


#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/ndk/inc/netmain.h>

#include "../h/knEthernetInit.h"

static const char *pIpAddr = "192.168.0.228";
static const char *pIpMask = "255.255.255.0";
static const char *pIpGateAddr = "0.0.0.0";
static const char *pHostName = "kotlin";
static const char *pDomainName = "kn.loc";

static void knNdkInitIp(void *pCfg);
static void knNetworkOpen(void);
static void knNetworkClose(void);
static void knNetworkIPAddr(uint32_t ipAddr, uint32_t ifIdx, uint32_t fAdd);

extern void llTimerTick();

void knInitEthernet(void)
{
    extern volatile cregister Uns DNUM;

    if ((1 << DNUM) & (1))
    {
        int resNc = -1;
        void *pCfg = NULL;
        ti_sysbios_knl_Clock_Params clockParams;
        ti_sysbios_knl_Clock_Handle handle;

        ti_sysbios_knl_Clock_Params_init(&clockParams);
        clockParams.startFlag = TRUE;
        clockParams.period = 100;
        handle = ti_sysbios_knl_Clock_create(&llTimerTick, clockParams.period, &clockParams, NULL);

        resNc = NC_SystemOpen(NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT);

        if(resNc)
        {
            while(1);
        }

        pCfg = CfgNew();

        if (NULL != pCfg)
        {
            knNdkInitIp(pCfg);
            do
            {
                resNc = NC_NetStart(pCfg, knNetworkOpen, knNetworkClose, knNetworkIPAddr);
            } while(resNc > 0);

            CfgFree(pCfg);
        }

        NC_SystemClose();

        ti_sysbios_knl_Clock_delete(&(handle));
    }
}

static void knNdkInitIp(void *pCfg)
{
    CI_IPNET ipNet;
    CI_ROUTE route;

    CfgAddEntry(pCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(pHostName), (uint8_t *)pHostName, NULL);

    memset(&(ipNet), 0, sizeof(CI_IPNET));

    ipNet.IPAddr = inet_addr(pIpAddr);
    ipNet.IPMask = inet_addr(pIpMask);
    ipNet.NetType = 0;
    if (strlen(pDomainName) < CFG_DOMAIN_MAX)
    {
        strcpy(ipNet.Domain, pDomainName);
    }

    CfgAddEntry(pCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (uint8_t *)&(ipNet), NULL);

    memset(&(route), 0, sizeof(CI_ROUTE));

    route.IPDestAddr = 0;
    route.IPDestMask = 0;
    route.IPGateAddr = inet_addr(pIpGateAddr);

    CfgAddEntry(pCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (uint8_t *)&(route), NULL);
}

static void knNetworkOpen(void)
{

}

static void knNetworkClose(void)
{

}

static void knNetworkIPAddr(uint32_t ipAddr, uint32_t ifIdx, uint32_t fAdd)
{

}

Cfg file:

6114.test_udp.cfg

  • Hi,

    Please share your findings so far. What is the problem you're experiencing with the NDK? Share some logs, share which EVM are you using (or is this a custom board). If it is a custom board, shortly describe the differences from the reference EVM (if possible).

    Best Regards,
    Yordan
  • Hi, Yordan!

    My board: TMDSEVM6657

    My program is testing udp-socket. I got to set up NDK stack via *.cfg file. I am trying to set up NDK via C code. When I am playing my program in TMDSEVM6657, initialization thread hangs in NC_NetStart() function or return -1. knNetworkOpen() function isn't call.

    My program is including knUdpStart() and knInitEthernet() functions. Threads for these functions are created via 6114.test_udp.cfg file.

  • I solved my problem!

    This code may have been required:

    var global = xdc.useModule("ti.ndk.config.Global");

    global.enableCodeGeneration = false;