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.
Tool/software: TI-RTOS
Hello,
I have a following problem with the getting started project called:
httpget_MSP_EXP432E401Y_tirtos_ccs_syscfg
when I change the IP address to static, and set external DNS server the hostname resolution failes. Same error with https example but SNTP connection failes first.
SimpleLink MSP432E4 SDK - v:3.10.00.11 Compiler: TI v18.12.2.LTS
Please see the attached project. Only the DHCP and the DNS settings are changed compared to the original example.
After reading this link: file:///C:/ti/simplelink_msp432e4_sdk_3_10_00_11/docs/ndk/NDK_Users_Guide.html#using-a-statically-defined-dns-server
I have cheked the generated code (using syscfg) and everything seems fine,
/* * ======== ti_ndk_config_external_dns_init ======== * Specify an external DNS server */ void ti_ndk_config_external_dns_init(void *hCfg) { uint32_t IPAddr = inet_addr("8.8.8.8"); if (IPAddr) { CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPAddr), (unsigned char *)&IPAddr, 0); } }
/* IP, TCP, and UDP config */ configIp(hCfg); configTcp(hCfg); configUdp(hCfg); /* add the external DNS server to the configuration */ ti_ndk_config_external_dns_init(hCfg); /* config low priority task stack size */ u32cval = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKLOW, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&u32cval, NULL); /* config normal priority task stack size */ u32cval = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKNORM, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&u32cval, NULL); /* config high priority task stack size */ u32cval = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKHIGH, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&u32cval, NULL); /* Boot the system using this configuration * * Loop until the function returns 0. This facilitates a reboot command. */ do { rc = NC_NetStart(hCfg, networkOpen, networkClose, networkIPAddr); /* user reboot hook == null */ } while (rc > 0);
but my code still doesnt work.
I have check the httpget example with static ip configuration with a launchpad EK-TM4C129EXL with the suggestion below:
And the host name resolution was OK, consequently we can ignore the network issue in my home environment.
It is getting more strange.
I have disabled the SysCfg.externalDNS settings, and there is my function that is used instead:
void addExternalDNS(){ uint32_t ip = inet_addr("8.8.8.8"); int status = 0; if (ip) { status = CfgAddEntry(0, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(uint32_t), (unsigned char *)&ip, 0); } Display_printf(display, 0, 0, "myDnsSetup: %d", status); }
The following hook is from the example:
httpget_MSP_EXP432E401Y_tirtos_ccs_syscfg
with only one modification.
/* * ======== netIPAddrHook ======== * user defined network IP address hook */ void netIPAddrHook(uint32_t IPAddr, unsigned int IfIdx, unsigned int fAdd) { pthread_t thread; pthread_attr_t attrs; struct sched_param priParam; int retc; int detachState; uint32_t hostByteAddr; static bool createTask = true; int32_t status = 0; if (fAdd) { Display_printf(display, 0, 0, "Network Added: "); } else { Display_printf(display, 0, 0, "Network Removed: "); } /* print the IP address that was added/removed */ hostByteAddr = NDK_ntohl(IPAddr); Display_printf(display, 0, 0, "If-%d:%d.%d.%d.%d\n", IfIdx, (uint8_t)(hostByteAddr>>24)&0xFF, (uint8_t)(hostByteAddr>>16)&0xFF, (uint8_t)(hostByteAddr>>8)&0xFF, (uint8_t)hostByteAddr&0xFF); status = SlNetSock_init(0); if (status != 0) { Display_printf(display, 0, 0, "SlNetSock_init fail (%d)\n", status); } status = SlNetIf_init(0); if (status != 0) { Display_printf(display, 0, 0, "SlNetIf_init fail (%d)\n", status); } status = SlNetUtil_init(0); if (status != 0) { Display_printf(display, 0, 0, "SlNetUtil_init fail (%d)\n", status); } status = SlNetIf_add(SLNETIF_ID_2, EMACMSP432E4_ETHERNET_NAME, (const SlNetIf_Config_t *)&SlNetIfConfigNDK, IFPRI); if (status != 0) { Display_printf(display, 0, 0, "SlNetIf_add fail (%d)\n", status); } if (fAdd && createTask) { addExternalDNS(); /* * Create the Task that farms out incoming TCP connections. * arg0 will be the port that this task listens to. */ /* Set priority and stack size attributes */ pthread_attr_init(&attrs); priParam.sched_priority = 1; detachState = PTHREAD_CREATE_DETACHED; retc = pthread_attr_setdetachstate(&attrs, detachState); if (retc != 0) { Display_printf(display, 0, 0, "netIPAddrHook: pthread_attr_setdetachstate() failed\n"); while (1); } pthread_attr_setschedparam(&attrs, &priParam); retc |= pthread_attr_setstacksize(&attrs, HTTPTASKSTACKSIZE); if (retc != 0) { Display_printf(display, 0, 0, "netIPAddrHook: pthread_attr_setstacksize() failed\n"); while (1); } retc = pthread_create(&thread, &attrs, httpTask, 0); if (retc != 0) { Display_printf(display, 0, 0, "netIPAddrHook: pthread_create() failed\n"); while (1); } createTask = false; } }
You can see the fx: addExternalDNS();
So, when I set a breakpoint on addExternalDNS() that halts the execution and resume it, the http get works fine, the hostname resolution works. However if I remove the breakpoint the resolution fails...
Hello Daniel,
I will ask my colleague who has more knowledge on this topic to look into it.
Thanks,
Sai
Hello Daniel,
I have been able to reproduce your issue, and it is indeed a tricky one to debug. Right now I'm adding some instrumentation to the NDK to see if I can track down the cause of this.
In the mean time I noticed you said that you checked the other post you linked to and then your "host name resolution was OK". Does that mean you get this to work in a previous version of the SDK or a non-syscfg version of the example?
Regards,
Dalton
Hello Dalton,
The project where the hostname resolution working is EK-TM4C129EXL project and not related to SimpleLink or MSP432.
Hello Daniel,
That makes sense. I just tracked down what is causing the issue. The E4's driver is reporting to the NS library that the connection status is down on the e4 in static ip case without breakpoints causing NS to think there are no available network interfaces. It appears to just take a while to see the connection status is actually up in the static IP case because the breakpoint must be giving enough time for the EMAC hardware to accurately determine connection status.
As a temporary fix I was able to get the project to work without breakpoints by placing a 2 second delay immediately after the SlNetIf_add() function in the hooks.c file. This should get you going for now, but I'll work on the driver code to get a solution that doesn't require magic delays.
Regards,
Dalton
Thank you for your effort and the answer as well. I am going to mark your reply as solution but I can try it some days later.
**Attention** This is a public forum