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: MSP432E401Y LP HTTP Server Example

Tool/software: TI-RTOS

Dear Community, 

I am looking for example for HTTPServer. I found this thread: 

RTOS/MSP-EXP432E401Y: HTTP Server with MSP432 - MSP low-power microcontroller forum - MSP low-power microcontrollers...

e2e.ti.com
Part Number: MSP-EXP432E401Y Other Parts Discussed in Thread: MSP432E401Y Tool/software: TI-RTOS I cannot comment to the original thread regarding the MSP432E401Y

but unfortunately it is not working for me with SDK 2.20.00.20 api. Can anyone help with an example or a guide? Thank you for your early reply.

  • I have the following observations: 

    I put the following code into to function: ndkStackThread 

        CI_SERVICE_HTTP http;
        memset( &http, 0, sizeof(http));
        http.param.MaxCon = 4;
        http.param.Port = 80;
    
        http.cisargs.pCbSrv = &serviceReport;
        http.cisargs.IfIdx = 1;
        http.cisargs.Mode = CIS_FLG_IFIDXVALID | CIS_FLG_RESOLVEIP;
    
        CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_HTTP, 0, sizeof(http), (unsigned char *)&http, 0 );
    

    resulting the following function

    static void ndkStackThread(uintptr_t arg0, uintptr_t arg1)
    {
        void *hCfg;
        int rc;
        timer_t ndkHeartBeat;
        struct sigevent sev;
        struct itimerspec its;
        struct itimerspec oldIts;
        int ndkHeartBeatCount = 0;
    
        /* create the NDK timer tick */
        sev.sigev_notify = SIGEV_SIGNAL;
        sev.sigev_value.sival_ptr = &ndkHeartBeatCount;
        sev.sigev_notify_attributes = NULL;
        sev.sigev_notify_function = &llTimerTick;
    
        rc = timer_create(CLOCK_MONOTONIC, &sev, &ndkHeartBeat);
        if (rc != 0) {
            Display_printf(display, 0, 0,
                    "ndkStackThread: failed to create timer (%d)\n");
        }
    
        /* start the NDK 100ms timer */
        its.it_interval.tv_sec = 0;
        its.it_interval.tv_nsec = 100000000;
        its.it_value.tv_sec = 0;
        its.it_value.tv_nsec = 100000000;
    
        rc = timer_settime(ndkHeartBeat, 0, &its, NULL);
        if (rc != 0) {
            Display_printf(display, 0, 0,
                    "ndkStackThread: failed to set time (%d)\n");
        }
    
        rc = NC_SystemOpen(NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT);
        if (rc) {
            Display_printf(display, 0, 0,
                    "ndkStackThread: NC_SystemOpen Failed (%d)\n");
        }
    
        /* create and build the system configuration from scratch. */
        hCfg = CfgNew();
        if (!hCfg) {
            Display_printf(display, 0, 0,
                    "ndkStackThread: Unable to create configuration\n");
            goto main_exit;
        }
    
        /* IP, TCP, and UDP config */
        initIp(hCfg);
        initTcp(hCfg);
        initUdp(hCfg);
    
    
    
        CI_SERVICE_HTTP http;
        memset( &http, 0, sizeof(http));
        http.param.MaxCon = 4;
        http.param.Port = 80;
    
        http.cisargs.pCbSrv = &serviceReport;
        http.cisargs.IfIdx = 1;
        http.cisargs.Mode = CIS_FLG_IFIDXVALID | CIS_FLG_RESOLVEIP;
    
    
        CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_HTTP, 0, sizeof(http), (unsigned char *)&http, 0 );
    
    
    
        /* config low priority tasks stack size */
        rc = 2048;
        CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKLOW, CFG_ADDMODE_UNIQUE,
                sizeof(uint32_t), (unsigned char *)&rc, NULL);
    
        /* config norm priority tasks stack size */
        rc = 2048;
        CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKNORM, CFG_ADDMODE_UNIQUE,
                sizeof(uint32_t), (unsigned char *)&rc, NULL);
    
        /* config high priority tasks stack size */
        rc = 2048;
        CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKHIGH, CFG_ADDMODE_UNIQUE,
                sizeof(uint32_t), (unsigned char *)&rc, NULL);
    
    
        CfgSetDefault(hCfg);
    
        do
        {
            rc = NC_NetStart(hCfg, networkOpen, networkClose, networkIPAddr);
        } while(rc > 0);
    
        /* Shut down the stack */
        CfgFree(hCfg);
    
    main_exit:
        NC_SystemClose();
    
        /* stop and delete the NDK heartbeat */
        its.it_value.tv_sec = 0;
        its.it_value.tv_nsec = 0;
    
        rc = timer_settime(ndkHeartBeat, 0, &its, &oldIts);
    
        rc = timer_delete(ndkHeartBeat);
    
        Display_printf(display, 0, 0, "ndkStackThread: exiting ...\n");
    }
    

    But the service status is always false:

    Service Status: HTTP     : Failed   :          : 000

    If I put the following code to the IpAddressHook:

        NTARGS args;
        args.CallMode = NT_MODE_IFIDX;
        args.IfIdx = 1;
        args.pCb = &cbFun;
        args.hCallback = NULL;
    
        NTPARAM_HTTP httpParam;
        httpParam.MaxCon = 4;
        httpParam.Port = NULL;
    
        void *hHTTP = httpOpen(&args, &httpParam);

    It seems the server has started. 

    I would like to use the Cfg Service way to make it work. 

    Looking forward your reply.

  • Hello Daniel,

    I currently don't have access to hardware. Give me a couple of days time to try it out and get back.

    Thanks,
    Sai
  • Thank you for your time. If you need additional info just let me know.
  • Hi Daniel,

    You should be able to get the original code working by linking in the following library:

    netctrl_ipv4.lib

    Please refer to the below screen shot. (note that there's no "_min_" in the library name).

    In the newer SDKs, the NDK libraries are no longer linked in automatically (as you've no doubt discovered), and the examples have been updated to link in the libraries manually.

    For example, if you used the tcpEcho example as a reference for linking the libraries, it will link in the 'netctrl_min' version of the NDK network control library. Since it doesn't use the HTTP server feature, it uses this "minimal" version.

    So, if you update your app to link in the version of the library with features, it should get you past this.

    Steve

  • Hi Steven,

    Thank you for your reply. 

    I read some similar here: 

    1.3.8 NETCTRL Libraries

    http://dev.ti.com/tirex/content/simplelink_msp432e4_sdk_2_20_00_20/docs/ndk/NDK_Users_Guide.html#SPRU5239674

    but I was not sure how to go on. As as understand, if I enable and configure the full control of netctrl lib. I can use the DHCPServer, NAT, etc.... with Cfg? 

  • Hello Daniel,

    Were you able to link the netctrl_ipv4.aem4f library as described by Steve?

    Your question on using XGCONF is different from the original question. I would recommend you to start a new post so that we can get it answered appropriately.

    Thanks,
    Sai
  • Hello,

    Sorry for my late response. I am sure that Steve's suggestion solves the problem, but I can not confirm now. I am working on TM4C platform at the moment and I will try the suggestion on the next week. 

    If I have any question remains I will ask.

    Thank you for your excellent support!

  • Hello Daniel,

    Did you get a chance to look into this Steve's suggestion? Do you need any more help on this topic?

    Thanks,
    Sai

**Attention** This is a public forum