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.

TI-RTOS and TCP/IP runtime change configuration

Other Parts Discussed in Thread: TM4C1294NCPDT

Hi all.

I need same support on TivaC129 board and NDK configuration.

I'm developing an application that need to change the IP parameters Runtime (i.e. during running application), this is why the user can choose IP static or dinamic during its setup made with a GUI istance.

The question is: do I have to use the NDK without XGCONF? or can I use the XGCONG to setup an initial configuration and then change it Runtime?

I've downloaded the package "nsp_1_10_02_09" but the only example I've found is cfgdemo but it's not for TIVA.

Thanks in advance

Marco Crivellari

  • Marco,

     Yes you can setup an initial configuration with XGCONF and make configuration changes at runtime. The cfgdemo is a good example to look at. I have to say it's platform independent, so the same code should work on your Tiva board. You can try running it on your board and let me know how it goes. Chapter 3 of the NDK users guide is a good read if you need more information on this.

    Let me know if you have any other questions

    Moses 

  • Hi Moses,

    Yes I have more questions.

    I've followed the example described into NDK user guide and I've compiled cfgdemo for TivaC129 with XGCONF. I've have also a good understand about hook functions but when I went to look into the c code generated something has left me perplexed and in fact the demo did not work.

    The questions are: 

    1. the Runtime configuration is changed using the MainConfiguration buffer, but NC_NetStart function doesn't read it when you set NC_NetStop(0). The handle "hCfg" never change

    2. The initial IP is setted by "ti_ndk_config_ip"_init but I want to read it from a my data structure

     

    Thanks in advance,

    Marco

  • Marco,

    Yes, you can do this.  Have a look at this forum.  See the response I made for a suggestion (search for "readIPAddr" function in the thread).

    At the time I posted it, that suggestion didn't work due to a bug (as the thread discusses), but that bug has since been fixed and you should be able to reassign the global variable that stores the IP address as I described.

    Steve

  • Hi Steve.

    Thank you for your support.

    So, if a try to summarize the question, we have that:

    - to change the static IP at  boot time in order to override the default IP from XGCONF you need "Stack begin" hook 

    - to change the static IP when the stack is running you need "Network open" hook and call NC_NetStop(1)

    is it correct?

     

    Another simple question at this point is: can I change the static IP into dynamic IP? If yes where can I find an example?

     

    Thanks in advance,

    Marco

  • Marco Crivellari said:
    - to change the static IP at  boot time in order to override the default IP from XGCONF you need "Stack begin" hook 

    Yes.  The stack begin hook will modify the static IP address, that's set in the global variable LocalIPAddr, at an early enough time to override the value that was set in the configuration.

    Marco Crivellari said:

    - to change the static IP when the stack is running you need "Network open" hook and call NC_NetStop(1)

    is it correct?

    No, you shouldn't need to do this. If you don't change it in that hook, it can still be done later.  However, at this point the IP address that was set in LocalIPAddr will have already been used to bind that address in the NDK.  So, at a later point you can change the static IP address that was already bound by using the CfgAddEntry API.  You must first call CfgAddEntry for the new IP address, and then again to add a route for it.  The thread I linked to previously has the example code for how to do that.

    Marco Crivellari said:
    can I change the static IP into dynamic IP? If yes where can I find an example?

    Yes, you should be able to do this.  You should just need to call call CfgAddEntry() for adding a DHCP client service.  I was able to add a DHCP service within the "network IP address hook" function, which is called as soon as an IP address is added (or removed) from the system.  In this case, that hook was called when the static IP address was bound, and then the DHCP code was run:

    extern Void ti_ndk_config_Global_serviceReport(uint Item, uint Status,
            uint Report, HANDLE h);
    void mynetworkIPAddrHook(IPN IPAddr, uint IfIdx, uint fAdd)
    {
        HANDLE hCfg = CfgGetDefault();

        if (hCfg) {
            CI_SERVICE_DHCPC dhcpc;

            System_printf("now adding DHCP...\n");

            // Specify DHCP Service on IF-1
            bzero( &dhcpc, sizeof(dhcpc) );
            dhcpc.cisargs.Mode   = CIS_FLG_IFIDXVALID;
            dhcpc.cisargs.IfIdx  = 1;
            dhcpc.cisargs.pCbSrv = &ti_ndk_config_Global_serviceReport;
            CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
                         sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );
        }
        else {
            System_printf("error: could not get handle to configuration\n");
        }
    }

    Steve

  • Hi Steve,

    I have tried tcpEcho example for TM4C1294NCPDT and was able to get the IP address. It waits if ethernet link is down.
    But once IP address is assigned and than Ethernet link becomes down, it does not change to "Network Removed". Can you please help me how to detect this?
    Also My requirement is to check full connectivity between Board and Server (lets say Weather server used in enet_io example). Lets say From Board to router connectivity is there and board has IP address, but Internet link is down from Router to server. How to know status of this?
    Need to check all this using TI-RTOS.
    Thanks,
    Bhavesh

  • Hi Bhavesh,

    This thread is closed. Can you please create a new thread under TI-RTOS and post your question there?

    Thanks,
    Vikram