MSP-EXP432E401Y: MSP-EXP432E401Y

Part Number: MSP-EXP432E401Y

Tool/software:

Hi,

I am using  MSP-EXP432E401Y board. 

I want to connect it to my PC using STATIC IP . 

i downloaded "ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs" sample project from examples in code composer studio . This project is based on DHCP network protocol. TO convert it into static IP mode I did this modification in enet_lwip.c file :

 lwIPInit(g_ui32SysClock, pui8MACArray, 3232235777, 4294967040, 0, IPADDR_USE_STATIC);

But still i am unable to ping it through my system.

Please tell me what else modification is required to make this board work in static IP mode.

4294967040 is equal to 255.255.255.0 in string

and 3232235777 is 192.168.1.1 in string

my system IP is 192.168.1.5

 

  • Hi,

      You need to also set the below two macros to 0 in the lwipopts.h file. 

    #define LWIP_DHCP 0

    #define LWIP_AUTOIP 0

  • I did as you said above but when i build code its showing error "identifier "ARP_TMR_INTERVAL" is undefined ". This parameter is present in etharp.h file. but still its showing undefined.

  • Hello sir,

    I just took the "#define ARP_TMR_INTERVAL 1000 " parameter from etharp.h file and copied it into  lwiplib.c file. After building the code a warning is displayed " function "etharp_tmr" declared implicitly" . How can i remove this warning and how much  relevant this warning is??

    when i loaded and ran this code on card Ethernet port of card starting pinging from my laptop.

    Using arp -a commad i can see MAC and IP of card too.

    I also want to know how can ensure that modified code is  configured to STATIC IP mode properly because when i ran code on card wireshark tool is capturing packets of HTTP search though i have masked " httpd_init();" function enet_lwip.c file .

  • Hi,

     In the lwiplib.c file, can you add the header file. See below. 

    If you can ping the device at the specified static address then the static address is working. 

  • Thanks,

    Warning that was appearing during the build removed after adding header file.

    Now ,

    I want to to send and receive udp packets from MCU . How can i proceed for that in code??? Is there any example code for this???

  • Warning that was appearing during the build removed after adding header file.

    Glad that the warning is resolved. 

    I want to to send and receive udp packets from MCU . How can i proceed for that in code??? Is there any example code for this???

    Why are you rejecting my answer if the warning is resolved. Just because you have a new question for udp so you reject my answer for an earlier question? You should be opening a new thread if you have a new question and not  reject people's answer so you can continue with a new question on the same thread. 

    There is UDP example in TI Resource Explorer but this is based on RTOS. See below. 

    For bare-metal lwIP UDP example, there is none for MSP432E but you can reference this app note  https://www.ti.com/lit/pdf/spna248 The lwip examples are for TM4C129 MCU which is the same silicon as MSP432E. 

  • Can u share its "udp.h" file . I am not getting it inside spna248 folder that I downloaded from link provided by you above.

    Also i want to know that whether syntax wise code written for TM4C129 will be same as for MSP432E or not.

    Can i use user defined functions in TM4C129  for MSP432E too.

  • Sorry i was not rejecting your answer . I am using this platform for the first time . I was just trying to keep the thread open to keep the chat in continuation.

  • Hi,

    //*****************************************************************************
    //
    // enet_lwip.c - Sample WebServer Application using lwIP.
    //
    // Copyright (c) 2013-2017 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "ti/devices/msp432e4/driverlib/driverlib.h"
    #include "ti/devices/msp432e4/inc/msp.h"
    #include "ustdlib.h"
    #include "uartstdio.h"
    #include "pinout.h"
    #include "locator.h"
    #include "lwiplib.h"
    #include "lwip/apps/httpd.h"
    
    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Ethernet with lwIP (enet_lwip)</h1>
    //!
    //! This example application demonstrates the operation of the MSP432E4
    //! Ethernet controller using the lwIP TCP/IP Stack.  DHCP is used to obtain
    //! an Ethernet address.  If DHCP times out without obtaining an address,
    //! AutoIP will be used to obtain a link-local address.  The address that is
    //! selected will be shown on the UART.
    //!
    //! UART0, connected to the ICDI virtual COM port and running at 115,200,
    //! 8-N-1, is used to display messages from this application. Use the
    //! following command to re-build the any file system files that change.
    //!
    //! ../../../../../tools/examples/makefsfile/makefsfile.exe -i fs -o enet_fsdata.h -r -h -q
    //!
    //! For additional details on lwIP, refer to the lwIP web page at:
    //! http://savannah.nongnu.org/projects/lwip/
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    
    struct udp_pcb *pcb;  // Assume this is properly initialized and configured
    struct pbuf *p;
    #define SYSTICKHZ               100
    #define SYSTICKMS               (1000 / SYSTICKHZ)
    
    //*****************************************************************************
    //
    // Interrupt priority definitions.  The top 3 bits of these values are
    // significant with lower values indicating higher priority interrupts.
    //
    //*****************************************************************************
    #define SYSTICK_INT_PRIORITY    0x80
    #define ETHERNET_INT_PRIORITY   0xC0
    #define PORT                     23
    
    //*****************************************************************************
    //
    // The current IP address.
    //
    //*****************************************************************************
    uint32_t g_ui32IPAddress;
    
    //*****************************************************************************
    //
    // The system clock frequency.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // Volatile global flag to manage LED blinking, since it is used in interrupt
    // and main application.  The LED blinks at the rate of SYSTICKHZ.
    //
    //*****************************************************************************
    volatile bool g_bLED;
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif
    
    
    
    void udp_send_data(struct udp_pcb *pcb, const char *data, size_t len) {
        // Create a packet buffer and fill it with data
        struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM);
        if (!p) {
            UARTprintf("Error allocating pbuf\n");
            return;
        }
        // Copy data into the packet buffer
        pbuf_take(p, data, len);
    
        // Send data using udp_send
        err_t err = udp_send(pcb, p);
        if (err != ERR_OK) {
            UARTprintf("Error sending UDP packet\n");
            return;
        }
    
        // Free the packet buffer
        pbuf_free(p);
    }
    
    void
    UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct
                ip_addr *addr, u16_t port)
    {
        if (p != NULL) {
            //
            // Send received packet back to sender. The udp_sendto is similar to
            // udp_send(), but sends to any remote address.
            //
            udp_sendto(pcb, p, addr, port);
    
            //
            // Free the pbuf.
            //
            pbuf_free(p);
        }
    }
    
    
    void
    UdpEchoInit(void)
    {
       // struct udp_pcb * pcb;
    
        //
        // Get the new PCB.
        //
        pcb = udp_new();
        if (pcb == NULL) {
            UARTprintf("udp_new failed!\n");
            return;
        }
    
        //
        // Bind to any IP address on port 23.
        //
        if (udp_bind(pcb, IP_ADDR_ANY, PORT) != ERR_OK) {
            UARTprintf("udp_bind failed!\n");
            return;
        }
    
        //
        // Register UdpEchoRecv() as callback function for received packets.
        //
        udp_recv(pcb, UdpEchoRecv, NULL);
    }
    
    
    
    
    //*****************************************************************************
    //
    // Display an lwIP type IP Address.
    //
    //*****************************************************************************
    void
    DisplayIPAddress(uint32_t ui32Addr)
    {
        char pcBuf[16];
    
        //
        // Convert the IP Address into a string.
        //
        usprintf(pcBuf, "%d.%d.%d.%d", ui32Addr & 0xff, (ui32Addr >> 8) & 0xff,
                (ui32Addr >> 16) & 0xff, (ui32Addr >> 24) & 0xff);
    
        //
        // Display the string.
        //
        UARTprintf(pcBuf);
    }
    
    //*****************************************************************************
    //
    // Required by lwIP library to support any host-related timer functions.
    //
    //*****************************************************************************
    void
    lwIPHostTimerHandler(void)
    {
        uint32_t ui32NewIPAddress;
    
        //
        // Get the current IP address.
        //
        ui32NewIPAddress = lwIPLocalIPAddrGet();
    
        //
        // See if the IP address has changed.
        //
        if(ui32NewIPAddress != g_ui32IPAddress)
        {
            //
            // See if there is an IP address assigned.
            //
            if(ui32NewIPAddress == 0xffffffff)
            {
                //
                // Indicate that there is no link.
                //
                UARTprintf("Waiting for link.\n");
            }
            else if(ui32NewIPAddress == 0)
            {
                //
                // There is no IP address, so indicate that the DHCP process is
                // running.
                //
                UARTprintf("Waiting for IP address.\n");
            }
            else
            {
                //
                // Display the new IP address.
                //
                UARTprintf("IP Address: ");
                DisplayIPAddress(ui32NewIPAddress);
                UARTprintf("\nOpen a browser and enter the IP address.\n");
            }
    
            //
            // Save the new IP address.
            //
            g_ui32IPAddress = ui32NewIPAddress;
        }
    
        //
        // If there is not an IP address.
        //
        if((ui32NewIPAddress == 0) || (ui32NewIPAddress == 0xffffffff))
        {
            //
            // Do nothing and keep waiting.
            //
        }
    }
    
    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTick_Handler(void)
    {
        //
        // Call the lwIP timer handler.
        //
        lwIPTimer(SYSTICKMS);
    
        //
        // Tell the application to change the state of the LED (in other words
        // blink).
        //
        g_bLED = true;
    }
    
    //*****************************************************************************
    //
    // This example demonstrates the use of the Ethernet Controller.
    //
    //*****************************************************************************
    int
    main(void)
    {
        uint32_t ui32User0, ui32User1;
        uint8_t pui8MACArray[8];
    
        //
        // Make sure the main oscillator is enabled because this is required by
        // the PHY.  The system must have a 25MHz crystal attached to the OSC
        // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
        // frequency is 10MHz or higher.
        //
        SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                                 SYSCTL_OSC_MAIN |
                                                 SYSCTL_USE_PLL |
                                                 SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Configure the device pins.
        //
        PinoutSet(true, false);
    
        //
        // Configure UART.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
    
        //
        // Clear the terminal and print banner.
        //
        UARTprintf("\033[2J\033[H");
        UARTprintf("Ethernet lwIP example\n\n");
    
        //
        // Configure Port N1 for as an output for the animation LED.
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
    
        //
        // Initialize LED to OFF (0)
        //
        MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1);
    
        //
        // Configure SysTick for a periodic interrupt.
        //
        MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
        MAP_SysTickEnable();
        MAP_SysTickIntEnable();
    
        //
        // Configure the hardware MAC address for Ethernet Controller filtering of
        // incoming packets.  The MAC address will be stored in the non-volatile
        // USER0 and USER1 registers.
        //
        MAP_FlashUserGet(&ui32User0, &ui32User1);
        if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
        {
            //
            // We should never get here.  This is an error if the MAC address has
            // not been programmed into the device.  Exit the program.
            // Let the user know there is no MAC address
            //
            UARTprintf("No MAC programmed!\n");
            while(1)
            {
            }
        }
    
        //
        // Tell the user what we are doing just now.
        //
        UARTprintf("Waiting for IP.\n");
    
        //
        // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
        // address needed to program the hardware registers, then program the MAC
        // address into the Ethernet Controller registers.
        //
        pui8MACArray[0] = ((ui32User0 >>  0) & 0xff);
        pui8MACArray[1] = ((ui32User0 >>  8) & 0xff);
        pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
        pui8MACArray[3] = ((ui32User1 >>  0) & 0xff);
        pui8MACArray[4] = ((ui32User1 >>  8) & 0xff);
        pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);
    
        //
        // Initialize the lwIP library, using DHCP.
        //
       // lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
        lwIPInit(g_ui32SysClock, pui8MACArray, 3232235777, 4294967040, 0, IPADDR_USE_STATIC);
        UdpEchoInit();
    
        const char *message = "Hello, World!";
       udp_send_data(pcb, message, 11);
    
        //
        // Setup the device locator service.
        //
        LocatorInit();
        LocatorMACAddrSet(pui8MACArray);
        LocatorAppTitleSet("MSP432E4 enet_io");
    
        //
        // Initialize a sample httpd server.
        //
      //  httpd_init();
    
        //
        // Set the interrupt priorities.  We set the SysTick interrupt to a higher
        // priority than the Ethernet interrupt to ensure that the file system
        // tick is processed if SysTick occurs while the Ethernet handler is being
        // processed.  This is very likely since all the TCP/IP and HTTP work is
        // done in the context of the Ethernet interrupt.
        //
        MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
        MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
    
        //
        // Loop forever, processing the LED blinking.  All the work is done in
        // interrupt handlers.
        //
        while(1)
        {
            //
            // Wait till the SysTick Interrupt indicates to change the state of the
            // LED.
            //
            while(g_bLED == false)
            {
            }
    
            //
            // Clear the flag.
            //
            g_bLED = false;
    
            //
            // Toggle the LED.
            //
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
                             (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
                              GPIO_PIN_1));
        }
    }
    

    I got udp.c and udp.h file . In enet_lwip.c file I added UdpEchoRecv, UdpEchoInit and udp_send_data function but still I am unable to see udp packet from MCU to my PC on wireshark tool

  • Hi,

      I have some questions.

      - What tool do you use to send udp data to the MCU? I normally use Hercules. https://www.hw-group.com/software/hercules-setup-utility. The UdpEchoRecv is a callback that is called when the Echo Server receives data. Upon receiving data, it simply echoes back to the sender (the client application running on the PC). Do you have data that is sent from the PC? What does it show?

      - Is your client on the same subnet as the server?

      - What is the result if you use DHCP? 

  • Hi,

    I made some modifications in code. Now in present case I am able to send packet from MCU to PC.  I checked that received packet on wireshark and Hercules too.

     When I am sending packet from PC (using hercules) to MCU then I can see packet on wireshark .

    On each packet send D3 LED of MCU is also blinking. But I don't know that whether packets are reaching to MCU or not and how to see those packets.

    I used UdpEchoRecv function and added code to print received messages. But when i am running that code and sending packet from hercules then nothing is printing on console of CCS. Also  inside UdpEchoRecv  there is a function  udp_sendto(pcb, p, addr, port) which should send same packet back to PC (hercules ) as an echo (acknowledgment), but there also I am not receiving any packet.

     I am sharing latest code file with you . Please see and guide how to solve this issue.

  • //*****************************************************************************
    //
    // enet_lwip.c - Sample WebServer Application using lwIP.
    //
    // Copyright (c) 2013-2017 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "ti/devices/msp432e4/driverlib/driverlib.h"
    #include "ti/devices/msp432e4/inc/msp.h"
    #include "ustdlib.h"
    #include "uartstdio.h"
    #include "pinout.h"
    #include "locator.h"
    #include "lwiplib.h"
    #include "lwip/apps/httpd.h"
    
    #include <stdio.h>
    #include "lwip/pbuf.h"
    #include "lwip/ip_addr.h"
    #include <string.h>
    //#include "inc/hw_ints.h"
    //#include "inc/hw_memmap.h"
    //#include "driverlib/flash.h"
    //#include "driverlib/interrupt.h"
    //#include "driverlib/gpio.h"
    //#include "driverlib/rom_map.h"
    //#include "driverlib/sysctl.h"
    //#include "driverlib/systick.h"
    //#include "utils/lwiplib.h"
    //#include "utils/ustdlib.h"
    //#include "utils/uartstdio.h"
    //#include "drivers/pinout.h"
    #include "lwip/udp.h"
    #include "lwip/inet.h"
    #include "lwip/ip_addr.h"
    
    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Ethernet with lwIP (enet_lwip)</h1>
    //!
    //! This example application demonstrates the operation of the MSP432E4
    //! Ethernet controller using the lwIP TCP/IP Stack.  DHCP is used to obtain
    //! an Ethernet address.  If DHCP times out without obtaining an address,
    //! AutoIP will be used to obtain a link-local address.  The address that is
    //! selected will be shown on the UART.
    //!
    //! UART0, connected to the ICDI virtual COM port and running at 115,200,
    //! 8-N-1, is used to display messages from this application. Use the
    //! following command to re-build the any file system files that change.
    //!
    //! ../../../../../tools/examples/makefsfile/makefsfile.exe -i fs -o enet_fsdata.h -r -h -q
    //!
    //! For additional details on lwIP, refer to the lwIP web page at:
    //! http://savannah.nongnu.org/projects/lwip/
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    
    struct udp_pcb *pcb;
    struct udp_pcb *upcb; // Assume this is properly initialized and configured
    struct pbuf *p;
    #define SYSTICKHZ               100
    #define SYSTICKMS               (1000 / SYSTICKHZ)
    
    //*****************************************************************************
    //
    // Interrupt priority definitions.  The top 3 bits of these values are
    // significant with lower values indicating higher priority interrupts.
    //
    //*****************************************************************************
    #define SYSTICK_INT_PRIORITY    0x80
    #define ETHERNET_INT_PRIORITY   0xC0
    #define PORT                     23
    
    
    #define SERVER_IPADDR "192.168.1.5"
    #define CLIENT_PORT 23
    #define SERVER_PORT 23
    
    //*****************************************************************************
    //
    // The current IP address.
    //
    //*****************************************************************************
    uint32_t g_ui32IPAddress;
    
    //*****************************************************************************
    //
    // The system clock frequency.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // Volatile global flag to manage LED blinking, since it is used in interrupt
    // and main application.  The LED blinks at the rate of SYSTICKHZ.
    //
    //*****************************************************************************
    volatile bool g_bLED;
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif
    
    //********************************************************************************
    
    struct ip_addr {
      u32_t addr;
    };
    void
    UdpClientInit(void)
    {
        struct pbuf *p;
        struct ip_addr ServerIPaddr;
      //  struct ip_addr *ServerIPaddr;
    
    
        err_t err;
        char *greeting = "Hello! Greeting from EK-TM4C129XL LaunchPad \r\n";
    
        //
        // Create a new UDP control block.
        //
        upcb = udp_new();
    
        if (upcb!=NULL)
        {
            //
            // Bind the PCB to local address=IP_ADDR_ANY at port 23.
            // Also register the callback function to call when receiving payload.
            //
            udp_bind(upcb, IP_ADDR_ANY, CLIENT_PORT);
           // udp_recv(upcb, UdpEchoRecv, NULL);
    
            //
            // Assign destination server IP address.
            //
           // ServerIPaddr.addr = inet_addr(SERVER_IPADDR);
            ServerIPaddr.addr = inet_addr("192.168.1.5");
    
            //
            // Configure destination IP address and port.
            //
            err = udp_connect(upcb, &ServerIPaddr, SERVER_PORT);
    
            if (err == ERR_OK)
            {
                //
                // Allocate pbuf from pool.
                //
                p = pbuf_alloc(PBUF_TRANSPORT,strlen((char*)greeting), PBUF_RAM);
    
                if (p != NULL)
                {
                    //
                    // Copy greeting to pbuf.
                    //
                    pbuf_take(p, (char*)greeting, strlen((char*)greeting));
    
                    //
                    // Send the UDP data.
                    //
                    udp_send(upcb, p);
    
                    //
                    // Free pbuf.
                    //
                    pbuf_free(p);
    
                }
                else
                {
                    //
                    // Free the UDP connection, so we can accept new clients.
                    //
                    udp_remove(upcb);
                    UARTprintf("\n\r can not allocate pbuf ");
                }
            }
            else
            {
                //
                // Free the UDP connection, so we can accept new clients.
                //
                udp_remove(upcb);
                UARTprintf("\n\r can not connect udp pcb");
            }
        }
        else
        {
            UARTprintf("\n\r can not create udp pcb");
        }
    
        //
        // Disconnect the remote address from the PCB.
        //
        udp_disconnect(upcb);
    
    }
    
    //void
    //UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
    //            struct ip_addr *addr, u16_t port)
    //{
    //    if (p != NULL) {
    //        //
    //        // Set global flag and print a message in main() indicating the number of
    //        // bytes that has been received from the remote host.
    //        //
    //        g_scbFlag.EchoRecv = 1;
    //        g_scbFlag.len = p->tot_len;
    //        //
    //        // Send received packet back to sender.
    //        //
    //        udp_sendto(pcb, p, addr, port);
    //
    //        //
    //        // Free the pbuf.
    //        //
    //        pbuf_free(p);
    //    }
    //}
    
    
    
    //
    void
    UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct
                ip_addr *addr, u16_t port)
    {
        if (p != NULL) {
            //
            // Send received packet back to sender. The udp_sendto is similar to
            // udp_send(), but sends to any remote address.
            //
            u8_t  i;
            struct pbuf *g;
    
            for(g = p; g != NULL; g = g->next) {
                    // Print the payload of each pbuf
                    for(i = 0; i < g->len; i++) {
                        printf("%c", *((char*)(g->payload + i)));
                    }
                }
            udp_sendto(pcb, p, addr, port);
    
            //
            // Free the pbuf.
            //
            pbuf_free(p);
        }
    }
    //
    //
    void
    UdpEchoInit(void)
    {
        struct udp_pcb * pcb;
    
        //
        // Get the new PCB.
        //
        pcb = udp_new();
        if (pcb == NULL) {
            UARTprintf("udp_new failed!\n");
            return;
        }
    
        //
        // Bind to any IP address on port 23.
        //
        if (udp_bind(pcb, IP_ADDR_ANY, PORT) != ERR_OK) {
            UARTprintf("udp_bind failed!\n");
            return;
        }
    
        //
        // Register UdpEchoRecv() as callback function for received packets.
        //
        udp_recv(pcb, UdpEchoRecv, NULL);
    }
    
    
    
    
    //*****************************************************************************
    //
    // Display an lwIP type IP Address.
    //
    //*****************************************************************************
    void
    DisplayIPAddress(uint32_t ui32Addr)
    {
        char pcBuf[16];
    
        //
        // Convert the IP Address into a string.
        //
        usprintf(pcBuf, "%d.%d.%d.%d", ui32Addr & 0xff, (ui32Addr >> 8) & 0xff,
                (ui32Addr >> 16) & 0xff, (ui32Addr >> 24) & 0xff);
    
        //
        // Display the string.
        //
        UARTprintf(pcBuf);
    }
    
    //*****************************************************************************
    //
    // Required by lwIP library to support any host-related timer functions.
    //
    //*****************************************************************************
    void
    lwIPHostTimerHandler(void)
    {
        uint32_t ui32NewIPAddress;
    
        //
        // Get the current IP address.
        //
        ui32NewIPAddress = lwIPLocalIPAddrGet();
    
        //
        // See if the IP address has changed.
        //
        if(ui32NewIPAddress != g_ui32IPAddress)
        {
            //
            // See if there is an IP address assigned.
            //
            if(ui32NewIPAddress == 0xffffffff)
            {
                //
                // Indicate that there is no link.
                //
                UARTprintf("Waiting for link.\n");
            }
            else if(ui32NewIPAddress == 0)
            {
                //
                // There is no IP address, so indicate that the DHCP process is
                // running.
                //
                UARTprintf("Waiting for IP address.\n");
            }
            else
            {
                //
                // Display the new IP address.
                //
                UARTprintf("IP Address: ");
                DisplayIPAddress(ui32NewIPAddress);
                UARTprintf("\nOpen a browser and enter the IP address.\n");
            }
    
            //
            // Save the new IP address.
            //
            g_ui32IPAddress = ui32NewIPAddress;
        }
    
        //
        // If there is not an IP address.
        //
        if((ui32NewIPAddress == 0) || (ui32NewIPAddress == 0xffffffff))
        {
            //
            // Do nothing and keep waiting.
            //
        }
    }
    
    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTick_Handler(void)
    {
        //
        // Call the lwIP timer handler.
        //
        lwIPTimer(SYSTICKMS);
    
        //
        // Tell the application to change the state of the LED (in other words
        // blink).
        //
        g_bLED = true;
    }
    
    //*****************************************************************************
    //
    // This example demonstrates the use of the Ethernet Controller.
    //
    //*****************************************************************************
    int
    main(void)
    {
        uint32_t ui32User0, ui32User1;
        uint8_t pui8MACArray[8];
    
        //
        // Make sure the main oscillator is enabled because this is required by
        // the PHY.  The system must have a 25MHz crystal attached to the OSC
        // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
        // frequency is 10MHz or higher.
        //
        SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                                 SYSCTL_OSC_MAIN |
                                                 SYSCTL_USE_PLL |
                                                 SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Configure the device pins.
        //
        PinoutSet(true, false);
    
        //
        // Configure UART.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
    
        //
        // Clear the terminal and print banner.
        //
        UARTprintf("\033[2J\033[H");
        UARTprintf("Ethernet lwIP example\n\n");
    
        //
        // Configure Port N1 for as an output for the animation LED.
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
    
        //
        // Initialize LED to OFF (0)
        //
        MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1);
    
        //
        // Configure SysTick for a periodic interrupt.
        //
        MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
        MAP_SysTickEnable();
        MAP_SysTickIntEnable();
    
        //
        // Configure the hardware MAC address for Ethernet Controller filtering of
        // incoming packets.  The MAC address will be stored in the non-volatile
        // USER0 and USER1 registers.
        //
        MAP_FlashUserGet(&ui32User0, &ui32User1);
        if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
        {
            //
            // We should never get here.  This is an error if the MAC address has
            // not been programmed into the device.  Exit the program.
            // Let the user know there is no MAC address
            //
            UARTprintf("No MAC programmed!\n");
            while(1)
            {
            }
        }
    
        //
        // Tell the user what we are doing just now.
        //
        UARTprintf("Waiting for IP.\n");
    
        //
        // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
        // address needed to program the hardware registers, then program the MAC
        // address into the Ethernet Controller registers.
        //
        pui8MACArray[0] = ((ui32User0 >>  0) & 0xff);
        pui8MACArray[1] = ((ui32User0 >>  8) & 0xff);
        pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
        pui8MACArray[3] = ((ui32User1 >>  0) & 0xff);
        pui8MACArray[4] = ((ui32User1 >>  8) & 0xff);
        pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);
    
        //
        // Initialize the lwIP library, using DHCP.
        //
       // lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
        lwIPInit(g_ui32SysClock, pui8MACArray, 3232235777, 4294967040, 0, IPADDR_USE_STATIC);
    
    
        //
         // Start the client to send a greeting message to the external host.
         //
         UdpClientInit();
       UdpEchoInit();
    
       // const char *message = "Hello, World!";
       //udp_send_data(pcb, message, 11);
    
        //
        // Setup the device locator service.
        //
        LocatorInit();
        LocatorMACAddrSet(pui8MACArray);
        LocatorAppTitleSet("MSP432E4 enet_io");
    
        //
        // Initialize a sample httpd server.
        //
      //  httpd_init();
    
        //
        // Set the interrupt priorities.  We set the SysTick interrupt to a higher
        // priority than the Ethernet interrupt to ensure that the file system
        // tick is processed if SysTick occurs while the Ethernet handler is being
        // processed.  This is very likely since all the TCP/IP and HTTP work is
        // done in the context of the Ethernet interrupt.
        //
        MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
        MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
    
        //
        // Loop forever, processing the LED blinking.  All the work is done in
        // interrupt handlers.
        //
        while(1)
        {
            //
            // Wait till the SysTick Interrupt indicates to change the state of the
            // LED.
            //
            while(g_bLED == false)
            {
            }
    
            //
            // Clear the flag.
            //
            g_bLED = false;
    
            //
            // Toggle the LED.
            //
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
                             (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
                              GPIO_PIN_1));
        }
    }
    

  • I'm confused where you call both UdpClientInit and UdpEchoInit in the main(). What are you trying to set up the MCU for? As a server or as a client? Why don't you start with the EchoServer example. In the enet_udpecho_server_lwip example, the MCU is a server and the PC is the client. The PC first sends message to the server and the server will echo back what it receives. 

  • Hi sir,

    I am using it as client and server both. I want to send and receive packet through this MCU.

    I made few more changes and now i am able to send and receive packet from MCU. But there are few warnings in code. I am sharing it with. Please tell how to resolve them.

    1)  Description    Resource    Path    Location    Type
    #1219-D arithmetic on pointer to void or function type    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 278    C/C++ Problem

    2)  Description    Resource    Path    Location    Type
    #169-D argument of type "struct ip_addr *" is incompatible with parameter of type "const ip_addr_t *"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 178    C/C++ Problem

    3) Description    Resource    Path    Location    Type
    #169-D argument of type "void (*)(void *, struct udp_pcb *, struct pbuf *, struct ip_addr *, u16_t)" is incompatible with parameter of type "udp_recv_fn"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 316    C/C++ Problem

  • //*****************************************************************************
    //
    // enet_lwip.c - Sample WebServer Application using lwIP.
    //
    // Copyright (c) 2013-2017 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "ti/devices/msp432e4/driverlib/driverlib.h"
    #include "ti/devices/msp432e4/inc/msp.h"
    #include "ustdlib.h"
    #include "uartstdio.h"
    #include "pinout.h"
    #include "locator.h"
    #include "lwiplib.h"
    #include "lwip/apps/httpd.h"
    
    #include <stdio.h>
    #include "lwip/pbuf.h"
    #include "lwip/ip_addr.h"
    #include <string.h>
    //#include "inc/hw_ints.h"
    //#include "inc/hw_memmap.h"
    //#include "driverlib/flash.h"
    //#include "driverlib/interrupt.h"
    //#include "driverlib/gpio.h"
    //#include "driverlib/rom_map.h"
    //#include "driverlib/sysctl.h"
    //#include "driverlib/systick.h"
    //#include "utils/lwiplib.h"
    //#include "utils/ustdlib.h"
    //#include "utils/uartstdio.h"
    //#include "drivers/pinout.h"
    #include "lwip/udp.h"
    #include "lwip/inet.h"
    #include "lwip/ip_addr.h"
    
    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Ethernet with lwIP (enet_lwip)</h1>
    //!
    //! This example application demonstrates the operation of the MSP432E4
    //! Ethernet controller using the lwIP TCP/IP Stack.  DHCP is used to obtain
    //! an Ethernet address.  If DHCP times out without obtaining an address,
    //! AutoIP will be used to obtain a link-local address.  The address that is
    //! selected will be shown on the UART.
    //!
    //! UART0, connected to the ICDI virtual COM port and running at 115,200,
    //! 8-N-1, is used to display messages from this application. Use the
    //! following command to re-build the any file system files that change.
    //!
    //! ../../../../../tools/examples/makefsfile/makefsfile.exe -i fs -o enet_fsdata.h -r -h -q
    //!
    //! For additional details on lwIP, refer to the lwIP web page at:
    //! http://savannah.nongnu.org/projects/lwip/
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    
    struct udp_pcb *pcb;
    struct udp_pcb *upcb; // Assume this is properly initialized and configured
    struct pbuf *p;
    #define SYSTICKHZ               100
    #define SYSTICKMS               (1000 / SYSTICKHZ)
    
    //*****************************************************************************
    //
    // Interrupt priority definitions.  The top 3 bits of these values are
    // significant with lower values indicating higher priority interrupts.
    //
    //*****************************************************************************
    #define SYSTICK_INT_PRIORITY    0x80
    #define ETHERNET_INT_PRIORITY   0xC0
    #define PORT                     23
    
    
    #define SERVER_IPADDR "192.168.1.5"
    #define CLIENT_PORT 23
    #define SERVER_PORT 23
    
    //*****************************************************************************
    //
    // The current IP address.
    //
    //*****************************************************************************
    uint32_t g_ui32IPAddress;
    
    //*****************************************************************************
    //
    // The system clock frequency.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // Volatile global flag to manage LED blinking, since it is used in interrupt
    // and main application.  The LED blinks at the rate of SYSTICKHZ.
    //
    //*****************************************************************************
    volatile bool g_bLED;
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif
    
    //********************************************************************************
    
    struct ip_addr {
      u32_t addr;
    };
    void
    UdpClientInit(void)
    {
        struct pbuf *p;
        struct ip_addr ServerIPaddr;
      //  struct ip_addr *ServerIPaddr;
    
    
        err_t err;
        char *greeting = "Hello! Greeting from EK-TM4C129XL LaunchPad \r\n";
        uint8_t data[] = { 0x01, 0x23, 0x45, 0x67, 0x89 };
    
        //
        // Create a new UDP control block.
        //
        upcb = udp_new();
    
        if (upcb!=NULL)
        {
            //
            // Bind the PCB to local address=IP_ADDR_ANY at port 23.
            // Also register the callback function to call when receiving payload.
            //
            udp_bind(upcb, IP_ADDR_ANY, CLIENT_PORT);
           // udp_recv(upcb, UdpEchoRecv, NULL);
    
            //
            // Assign destination server IP address.
            //
           // ServerIPaddr.addr = inet_addr(SERVER_IPADDR);
            ServerIPaddr.addr = inet_addr("192.168.1.5");
    
            //
            // Configure destination IP address and port.
            //
            err = udp_connect(upcb, &ServerIPaddr, SERVER_PORT);
    
            if (err == ERR_OK)
            {
                //
                // Allocate pbuf from pool.
                //
              //  p = pbuf_alloc(PBUF_TRANSPORT,strlen((char*)greeting), PBUF_RAM);
                p = pbuf_alloc(PBUF_TRANSPORT, sizeof(data), PBUF_RAM);
    
                if (p != NULL)
                {
                    //
                    // Copy greeting to pbuf.
                    //
                    memcpy(p->payload, data, sizeof(data));
                   // pbuf_take(p, (char*)greeting, strlen((char*)greeting));
    
                    //
                    // Send the UDP data.
                    //
                    udp_send(upcb, p);
    
                    //
                    // Free pbuf.
                    //
                    pbuf_free(p);
    
                }
                else
                {
                    //
                    // Free the UDP connection, so we can accept new clients.
                    //
                    udp_remove(upcb);
                    UARTprintf("\n\r can not allocate pbuf ");
                }
            }
            else
            {
                //
                // Free the UDP connection, so we can accept new clients.
                //
                udp_remove(upcb);
                UARTprintf("\n\r can not connect udp pcb");
            }
        }
        else
        {
            UARTprintf("\n\r can not create udp pcb");
        }
    
        //
        // Disconnect the remote address from the PCB.
        //
        udp_disconnect(upcb);
    
    }
    
    //void
    //UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
    //            struct ip_addr *addr, u16_t port)
    //{
    //    if (p != NULL) {
    //        //
    //        // Set global flag and print a message in main() indicating the number of
    //        // bytes that has been received from the remote host.
    //        //
    //        g_scbFlag.EchoRecv = 1;
    //        g_scbFlag.len = p->tot_len;
    //        //
    //        // Send received packet back to sender.
    //        //
    //        udp_sendto(pcb, p, addr, port);
    //
    //        //
    //        // Free the pbuf.
    //        //
    //        pbuf_free(p);
    //    }
    //}
    
    
    
    //
    void
    UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct
                ip_addr *addr, u16_t port)
    {
        if (p != NULL) {
            //
            // Send received packet back to sender. The udp_sendto is similar to
            // udp_send(), but sends to any remote address.
            //
            u8_t  i;
            struct pbuf *g;
    
            for(g = p; g != NULL; g = g->next) {
                    // Print the payload of each pbuf
                    for(i = 0; i < g->len; i++) {
                        UARTprintf("%c", *((char*)(g->payload + i)));
                    }
                }
            udp_sendto(pcb, p, addr, port);
    
            //
            // Free the pbuf.
            //
            pbuf_free(p);
        }
    }
    //
    //
    void
    UdpEchoInit(void)
    {
        struct udp_pcb * pcb;
    
        //
        // Get the new PCB.
        //
        pcb = udp_new();
        if (pcb == NULL) {
            UARTprintf("udp_new failed!\n");
            return;
        }
    
        //
        // Bind to any IP address on port 23.
        //
        if (udp_bind(pcb, IP_ADDR_ANY, 25) != ERR_OK) {
            UARTprintf("udp_bind failed!\n");
            return;
        }
    
        //
        // Register UdpEchoRecv() as callback function for received packets.
        //
        udp_recv(pcb, UdpEchoRecv, NULL);
    }
    
    
    
    
    //*****************************************************************************
    //
    // Display an lwIP type IP Address.
    //
    //*****************************************************************************
    void
    DisplayIPAddress(uint32_t ui32Addr)
    {
        char pcBuf[16];
    
        //
        // Convert the IP Address into a string.
        //
        usprintf(pcBuf, "%d.%d.%d.%d", ui32Addr & 0xff, (ui32Addr >> 8) & 0xff,
                (ui32Addr >> 16) & 0xff, (ui32Addr >> 24) & 0xff);
    
        //
        // Display the string.
        //
        UARTprintf(pcBuf);
    }
    
    //*****************************************************************************
    //
    // Required by lwIP library to support any host-related timer functions.
    //
    //*****************************************************************************
    void
    lwIPHostTimerHandler(void)
    {
        uint32_t ui32NewIPAddress;
    
        //
        // Get the current IP address.
        //
        ui32NewIPAddress = lwIPLocalIPAddrGet();
    
        //
        // See if the IP address has changed.
        //
        if(ui32NewIPAddress != g_ui32IPAddress)
        {
            //
            // See if there is an IP address assigned.
            //
            if(ui32NewIPAddress == 0xffffffff)
            {
                //
                // Indicate that there is no link.
                //
                UARTprintf("Waiting for link.\n");
            }
            else if(ui32NewIPAddress == 0)
            {
                //
                // There is no IP address, so indicate that the DHCP process is
                // running.
                //
                UARTprintf("Waiting for IP address.\n");
            }
            else
            {
                //
                // Display the new IP address.
                //
                UARTprintf("IP Address: ");
                DisplayIPAddress(ui32NewIPAddress);
              //  UARTprintf("\nOpen a browser and enter the IP address.\n");
            }
    
            //
            // Save the new IP address.
            //
            g_ui32IPAddress = ui32NewIPAddress;
        }
    
        //
        // If there is not an IP address.
        //
        if((ui32NewIPAddress == 0) || (ui32NewIPAddress == 0xffffffff))
        {
            //
            // Do nothing and keep waiting.
            //
        }
    }
    
    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTick_Handler(void)
    {
        //
        // Call the lwIP timer handler.
        //
        lwIPTimer(SYSTICKMS);
    
        //
        // Tell the application to change the state of the LED (in other words
        // blink).
        //
        g_bLED = true;
    }
    
    //*****************************************************************************
    //
    // This example demonstrates the use of the Ethernet Controller.
    //
    //*****************************************************************************
    int
    main(void)
    {
        uint32_t ui32User0, ui32User1;
        uint8_t pui8MACArray[8];
    
        //
        // Make sure the main oscillator is enabled because this is required by
        // the PHY.  The system must have a 25MHz crystal attached to the OSC
        // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
        // frequency is 10MHz or higher.
        //
        SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                                 SYSCTL_OSC_MAIN |
                                                 SYSCTL_USE_PLL |
                                                 SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Configure the device pins.
        //
        PinoutSet(true, false);
    
        //
        // Configure UART.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
    
        //
        // Clear the terminal and print banner.
        //
        UARTprintf("\033[2J\033[H");
        UARTprintf("Ethernet lwIP example\n\n");
    
        //
        // Configure Port N1 for as an output for the animation LED.
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
    
        //
        // Initialize LED to OFF (0)
        //
        MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1);
    
        //
        // Configure SysTick for a periodic interrupt.
        //
        MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
        MAP_SysTickEnable();
        MAP_SysTickIntEnable();
    
        //
        // Configure the hardware MAC address for Ethernet Controller filtering of
        // incoming packets.  The MAC address will be stored in the non-volatile
        // USER0 and USER1 registers.
        //
        MAP_FlashUserGet(&ui32User0, &ui32User1);
        if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
        {
            //
            // We should never get here.  This is an error if the MAC address has
            // not been programmed into the device.  Exit the program.
            // Let the user know there is no MAC address
            //
            UARTprintf("No MAC programmed!\n");
            while(1)
            {
            }
        }
    
        //
        // Tell the user what we are doing just now.
        //
        UARTprintf("Waiting for IP.\n");
    
        //
        // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
        // address needed to program the hardware registers, then program the MAC
        // address into the Ethernet Controller registers.
        //
        pui8MACArray[0] = ((ui32User0 >>  0) & 0xff);
        pui8MACArray[1] = ((ui32User0 >>  8) & 0xff);
        pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
        pui8MACArray[3] = ((ui32User1 >>  0) & 0xff);
        pui8MACArray[4] = ((ui32User1 >>  8) & 0xff);
        pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);
    
        //
        // Initialize the lwIP library, using DHCP.
        //
       // lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
        lwIPInit(g_ui32SysClock, pui8MACArray, 3232235777, 4294967040, 0, IPADDR_USE_STATIC);
    
    
        //
         // Start the client to send a greeting message to the external host.
         //
          UdpEchoInit();
         UdpClientInit();
    
    
       // const char *message = "Hello, World!";
       //udp_send_data(pcb, message, 11);
    
        //
        // Setup the device locator service.
        //
        LocatorInit();
        LocatorMACAddrSet(pui8MACArray);
        LocatorAppTitleSet("MSP432E4 enet_io");
    
        //
        // Initialize a sample httpd server.
        //
      //  httpd_init();
    
        //
        // Set the interrupt priorities.  We set the SysTick interrupt to a higher
        // priority than the Ethernet interrupt to ensure that the file system
        // tick is processed if SysTick occurs while the Ethernet handler is being
        // processed.  This is very likely since all the TCP/IP and HTTP work is
        // done in the context of the Ethernet interrupt.
        //
        MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
        MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
    
        //
        // Loop forever, processing the LED blinking.  All the work is done in
        // interrupt handlers.
        //
        while(1)
        {
            //
            // Wait till the SysTick Interrupt indicates to change the state of the
            // LED.
            //
            while(g_bLED == false)
            {
            }
    
            //
            // Clear the flag.
            //
            g_bLED = false;
    
            //
            // Toggle the LED.
            //
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
                             (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
                              GPIO_PIN_1));
        }
    }
    

  • 1)  Description    Resource    Path    Location    Type
    #1219-D arithmetic on pointer to void or function type    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 278    C/C++ Problem

    2)  Description    Resource    Path    Location    Type
    #169-D argument of type "struct ip_addr *" is incompatible with parameter of type "const ip_addr_t *"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 178    C/C++ Problem

    3) Description    Resource    Path    Location    Type
    #169-D argument of type "void (*)(void *, struct udp_pcb *, struct pbuf *, struct ip_addr *, u16_t)" is incompatible with parameter of type "udp_recv_fn"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 316    C/C++ Problem

    Are these warning or errors? Are you sure the line numbers you show for example like 278  match your source code?

    I am using it as client and server both. I want to send and receive packet through this MCU.

    As I mentioned, why don't you start with one at a time making sure each (either as a sever or as a client) works first.

  • hi

    Sir these are warnings not error. line numbers are not correct. I think line numbers are changing after the upload process. 

    I am sharing code again.

    Following are the lines showing error

     1) " err = udp_connect(upcb, &ServerIPaddr, SERVER_PORT)"

    Warning :   

    Description    Resource    Path    Location    Type
    #169-D argument of type "struct ip_addr *" is incompatible with parameter of type "const ip_addr_t *"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 180    C/C++ Problem

    2) " udp_sendto(pcb, b, addr, port); " 

    Warning :

    Description    Resource    Path    Location    Type
    #169-D argument of type "struct ip_addr *" is incompatible with parameter of type "const ip_addr_t *"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 287    C/C++ Problem

    3)  " udp_recv(pcb, UdpEchoRecv, NULL); "

    Warning :

    Description    Resource    Path    Location    Type
    #169-D argument of type "void (*)(void *, struct udp_pcb *, struct pbuf *, struct ip_addr *, u16_t)" is incompatible with parameter of type "udp_recv_fn"    enet_lwip.c    /ethernet_with_lwip_MSP_EXP432E401Y_nortos_ccs    line 322    C/C++ Problem

    And One more query If I use this Micro-controller in my design then which JTAG should I use to program it.

    //*****************************************************************************
    //
    // enet_lwip.c - Sample WebServer Application using lwIP.
    //
    // Copyright (c) 2013-2017 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "ti/devices/msp432e4/driverlib/driverlib.h"
    #include "ti/devices/msp432e4/inc/msp.h"
    #include "ustdlib.h"
    #include "uartstdio.h"
    #include "pinout.h"
    #include "locator.h"
    #include "lwiplib.h"
    #include "lwip/apps/httpd.h"
    
    #include <stdio.h>
    #include "lwip/pbuf.h"
    #include "lwip/ip_addr.h"
    #include <string.h>
    //#include "inc/hw_ints.h"
    //#include "inc/hw_memmap.h"
    //#include "driverlib/flash.h"
    //#include "driverlib/interrupt.h"
    //#include "driverlib/gpio.h"
    //#include "driverlib/rom_map.h"
    //#include "driverlib/sysctl.h"
    //#include "driverlib/systick.h"
    //#include "utils/lwiplib.h"
    //#include "utils/ustdlib.h"
    //#include "utils/uartstdio.h"
    //#include "drivers/pinout.h"
    #include "lwip/udp.h"
    #include "lwip/inet.h"
    #include "lwip/ip_addr.h"
    
    //*****************************************************************************
    //
    //! \addtogroup example_list
    //! <h1>Ethernet with lwIP (enet_lwip)</h1>
    //!
    //! This example application demonstrates the operation of the MSP432E4
    //! Ethernet controller using the lwIP TCP/IP Stack.  DHCP is used to obtain
    //! an Ethernet address.  If DHCP times out without obtaining an address,
    //! AutoIP will be used to obtain a link-local address.  The address that is
    //! selected will be shown on the UART.
    //!
    //! UART0, connected to the ICDI virtual COM port and running at 115,200,
    //! 8-N-1, is used to display messages from this application. Use the
    //! following command to re-build the any file system files that change.
    //!
    //! ../../../../../tools/examples/makefsfile/makefsfile.exe -i fs -o enet_fsdata.h -r -h -q
    //!
    //! For additional details on lwIP, refer to the lwIP web page at:
    //! http://savannah.nongnu.org/projects/lwip/
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    
    struct udp_pcb *pcb;
    struct udp_pcb *upcb; // Assume this is properly initialized and configured
    struct pbuf *p;
    #define SYSTICKHZ               100
    #define SYSTICKMS               (1000 / SYSTICKHZ)
    
    //*****************************************************************************
    //
    // Interrupt priority definitions.  The top 3 bits of these values are
    // significant with lower values indicating higher priority interrupts.
    //
    //*****************************************************************************
    #define SYSTICK_INT_PRIORITY    0x80
    #define ETHERNET_INT_PRIORITY   0xC0
    #define PORT                     23
    
    
    #define SERVER_IPADDR "192.168.1.5"
    #define CLIENT_PORT 23
    #define SERVER_PORT 23
    u8_t  r;
    u8_t  flag;
    //*****************************************************************************
    //
    // The current IP address.
    //
    //*****************************************************************************
    uint32_t g_ui32IPAddress;
    
    //*****************************************************************************
    //
    // The system clock frequency.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // Volatile global flag to manage LED blinking, since it is used in interrupt
    // and main application.  The LED blinks at the rate of SYSTICKHZ.
    //
    //*****************************************************************************
    volatile bool g_bLED;
    
    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif
    
    //********************************************************************************
    
    struct ip_addr {
      u32_t addr;
    };
    struct pbuf *p;
    void
    UdpClientInit(void)
    {
       ///////// struct pbuf *p;
        struct ip_addr ServerIPaddr;
      //  struct ip_addr *ServerIPaddr;
    
    
        err_t err;
        char *greeting = "Hello! Greeting from EK-TM4C129XL LaunchPad \r\n";
      //  uint8_t data[] = { 76, 69, 68, 95, 79, 78 };
    
        //
        // Create a new UDP control block.
        //
        upcb = udp_new();
    
        if (upcb!=NULL)
        {
            //
            // Bind the PCB to local address=IP_ADDR_ANY at port 23.
            // Also register the callback function to call when receiving payload.
            //
            udp_bind(upcb, IP_ADDR_ANY, CLIENT_PORT);
           // udp_recv(upcb, UdpEchoRecv, NULL);
    
            //
            // Assign destination server IP address.
            //
           // ServerIPaddr.addr = inet_addr(SERVER_IPADDR);
            ServerIPaddr.addr = inet_addr("192.168.1.5");
    
            //
            // Configure destination IP address and port.
            //
            err = udp_connect(upcb, &ServerIPaddr, SERVER_PORT);
    
            if (err == ERR_OK)
            {
                //
                // Allocate pbuf from pool.
                //
              //  p = pbuf_alloc(PBUF_TRANSPORT,strlen((char*)greeting), PBUF_RAM);
              //  p = pbuf_alloc(PBUF_TRANSPORT, sizeof(data), PBUF_RAM);
                flag=1;
    //            if (p != NULL)
    //            {
    //                //
    //                // Copy greeting to pbuf.
    //                //
    //             //   memcpy(p->payload, data, sizeof(data));
    //               // pbuf_take(p, (char*)greeting, strlen((char*)greeting));
    //
    //                //
    //                // Send the UDP data.
    //                //
    //
    //
    //               // udp_send(upcb, p);
    //
    //
    //
    //                //
    //                // Free pbuf.
    //                //
    //        /////   pbuf_free(p);
    //
    //            }
    //            else
    //            {
    //                //
    //                // Free the UDP connection, so we can accept new clients.
    //                //
    //                udp_remove(upcb);
    //                UARTprintf("\n\r can not allocate pbuf ");
    //            }
            }
            else
            {
                //
                // Free the UDP connection, so we can accept new clients.
                //
                udp_remove(upcb);
                UARTprintf("\n\r can not connect udp pcb");
            }
        }
        else
        {
            UARTprintf("\n\r can not create udp pcb");
        }
    
        //
        // Disconnect the remote address from the PCB.
        //
       ///////////////////// udp_disconnect(upcb);
    
    }
    
    //void
    //UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
    //            struct ip_addr *addr, u16_t port)
    //{
    //    if (p != NULL) {
    //        //
    //        // Set global flag and print a message in main() indicating the number of
    //        // bytes that has been received from the remote host.
    //        //
    //        g_scbFlag.EchoRecv = 1;
    //        g_scbFlag.len = p->tot_len;
    //        //
    //        // Send received packet back to sender.
    //        //
    //        udp_sendto(pcb, p, addr, port);
    //
    //        //
    //        // Free the pbuf.
    //        //
    //        pbuf_free(p);
    //    }
    //}
    
    
    
    //
    void
    UdpEchoRecv(void *arg, struct udp_pcb *pcb, struct pbuf *b, struct
                ip_addr *addr, u16_t port)
    {
        if (b != NULL) {
            //
            // Send received packet back to sender. The udp_sendto is similar to
            // udp_send(), but sends to any remote address.
            //
            u8_t  i;
            struct pbuf *g;
    
            for(g = b; g != NULL; g = g->next) {
                    // Print the payload of each pbuf
                    for(i = 0; i < g->len; i++) {
                        UARTprintf("%c", *((char*)(g->payload + i)));
                    }
                }
            udp_sendto(pcb, b, addr, port);
    
            //
            // Free the pbuf.
            //
            pbuf_free(b);
        }
    }
    //
    //
    void
    UdpEchoInit(void)
    {
        struct udp_pcb * pcb;
    
        //
        // Get the new PCB.
        //
        pcb = udp_new();
        if (pcb == NULL) {
            UARTprintf("udp_new failed!\n");
            return;
        }
    
        //
        // Bind to any IP address on port 23.
        //
        if (udp_bind(pcb, IP_ADDR_ANY, 25) != ERR_OK) {
            UARTprintf("udp_bind failed!\n");
            return;
        }
    
        //
        // Register UdpEchoRecv() as callback function for received packets.
        //
        udp_recv(pcb, UdpEchoRecv, NULL);
    }
    
    
    
    
    //*****************************************************************************
    //
    // Display an lwIP type IP Address.
    //
    //*****************************************************************************
    void
    DisplayIPAddress(uint32_t ui32Addr)
    {
        char pcBuf[16];
    
        //
        // Convert the IP Address into a string.
        //
        usprintf(pcBuf, "%d.%d.%d.%d", ui32Addr & 0xff, (ui32Addr >> 8) & 0xff,
                (ui32Addr >> 16) & 0xff, (ui32Addr >> 24) & 0xff);
    
        //
        // Display the string.
        //
        UARTprintf(pcBuf);
    }
    
    //*****************************************************************************
    //
    // Required by lwIP library to support any host-related timer functions.
    //
    //*****************************************************************************
    void
    lwIPHostTimerHandler(void)
    {
        uint32_t ui32NewIPAddress;
    
        //
        // Get the current IP address.
        //
        ui32NewIPAddress = lwIPLocalIPAddrGet();
    
        //
        // See if the IP address has changed.
        //
        if(ui32NewIPAddress != g_ui32IPAddress)
        {
            //
            // See if there is an IP address assigned.
            //
            if(ui32NewIPAddress == 0xffffffff)
            {
                //
                // Indicate that there is no link.
                //
                UARTprintf("Waiting for link.\n");
            }
            else if(ui32NewIPAddress == 0)
            {
                //
                // There is no IP address, so indicate that the DHCP process is
                // running.
                //
                UARTprintf("Waiting for IP address.\n");
            }
            else
            {
                //
                // Display the new IP address.
                //
                UARTprintf("IP Address: ");
                DisplayIPAddress(ui32NewIPAddress);
              //  UARTprintf("\nOpen a browser and enter the IP address.\n");
            }
    
            //
            // Save the new IP address.
            //
            g_ui32IPAddress = ui32NewIPAddress;
        }
    
        //
        // If there is not an IP address.
        //
        if((ui32NewIPAddress == 0) || (ui32NewIPAddress == 0xffffffff))
        {
            //
            // Do nothing and keep waiting.
            //
        }
    }
    
    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTick_Handler(void)
    {
        //
        // Call the lwIP timer handler.
        //
        lwIPTimer(SYSTICKMS);
    
        //
        // Tell the application to change the state of the LED (in other words
        // blink).
        //
        g_bLED = true;
    }
    
    //*****************************************************************************
    //
    // This example demonstrates the use of the Ethernet Controller.
    //
    //*****************************************************************************
    int
    main(void)
    {
        uint32_t ui32User0, ui32User1;
        uint8_t pui8MACArray[8];
    
        //
        // Make sure the main oscillator is enabled because this is required by
        // the PHY.  The system must have a 25MHz crystal attached to the OSC
        // pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
        // frequency is 10MHz or higher.
        //
        SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                                 SYSCTL_OSC_MAIN |
                                                 SYSCTL_USE_PLL |
                                                 SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Configure the device pins.
        //
        PinoutSet(true, false);
    
        //
        // Configure UART.
        //
        UARTStdioConfig(0, 115200, g_ui32SysClock);
    
        //
        // Clear the terminal and print banner.
        //
        UARTprintf("\033[2J\033[H");
        UARTprintf("Ethernet lwIP example\n\n");
    
        //
        // Configure Port N1 for as an output for the animation LED.
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
    
        //
        // Initialize LED to OFF (0)
        //
        MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~GPIO_PIN_1);
    
        //
        // Configure SysTick for a periodic interrupt.
        //
        MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
        MAP_SysTickEnable();
        MAP_SysTickIntEnable();
    
        //
        // Configure the hardware MAC address for Ethernet Controller filtering of
        // incoming packets.  The MAC address will be stored in the non-volatile
        // USER0 and USER1 registers.
        //
        MAP_FlashUserGet(&ui32User0, &ui32User1);
        if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
        {
            //
            // We should never get here.  This is an error if the MAC address has
            // not been programmed into the device.  Exit the program.
            // Let the user know there is no MAC address
            //
            UARTprintf("No MAC programmed!\n");
            while(1)
            {
            }
        }
    
        //
        // Tell the user what we are doing just now.
        //
        UARTprintf("Waiting for IP.\n");
    
        //
        // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
        // address needed to program the hardware registers, then program the MAC
        // address into the Ethernet Controller registers.
        //
        pui8MACArray[0] = ((ui32User0 >>  0) & 0xff);
        pui8MACArray[1] = ((ui32User0 >>  8) & 0xff);
        pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
        pui8MACArray[3] = ((ui32User1 >>  0) & 0xff);
        pui8MACArray[4] = ((ui32User1 >>  8) & 0xff);
        pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);
    
        //
        // Initialize the lwIP library, using DHCP.
        //
       // lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
        lwIPInit(g_ui32SysClock, pui8MACArray, 3232235777, 4294967040, 0, IPADDR_USE_STATIC);
    
    
        //
         // Start the client to send a greeting message to the external host.
         //
    
        MAP_GPIOPinTypeGPIOInput(GPIO_PORTH_BASE, GPIO_PIN_1);
        r= MAP_GPIOPinRead(GPIO_PORTH_BASE, GPIO_PIN_1);
        UARTprintf("GPIO_PIN_1 %i value  ",r);
    
        MAP_GPIOPinTypeGPIOInput(GPIO_PORTH_BASE, GPIO_PIN_0);
        u8_t  n= MAP_GPIOPinRead(GPIO_PORTH_BASE, GPIO_PIN_0);
        UARTprintf(" GPIO_PIN_0 %i value  ",n);
    
        MAP_GPIOPinTypeGPIOInput(GPIO_PORTH_BASE, GPIO_PIN_2);
        u8_t  c= MAP_GPIOPinRead(GPIO_PORTH_BASE, GPIO_PIN_2);
        UARTprintf(" GPIO_PIN_2 %i value  ",c);
    
         UdpEchoInit();
         UdpClientInit();
    
       // const char *message = "Hello, World!";
       //udp_send_data(pcb, message, 11);
    
        //
        // Setup the device locator service.
        //
        LocatorInit();
        LocatorMACAddrSet(pui8MACArray);
        LocatorAppTitleSet("MSP432E4 enet_io");
    
        //
        // Initialize a sample httpd server.
        //
      //  httpd_init();
    
        //
        // Set the interrupt priorities.  We set the SysTick interrupt to a higher
        // priority than the Ethernet interrupt to ensure that the file system
        // tick is processed if SysTick occurs while the Ethernet handler is being
        // processed.  This is very likely since all the TCP/IP and HTTP work is
        // done in the context of the Ethernet interrupt.
        //
        MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
        MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
    
        //
        // Loop forever, processing the LED blinking.  All the work is done in
        // interrupt handlers.
        //
        while(1)
        {
            //
            // Wait till the SysTick Interrupt indicates to change the state of the
            // LED.
            //
            while(g_bLED == false)
            {
            }
    
            //
            // Clear the flag.
            //
            g_bLED = false;
    
            //
            // Toggle the LED.
            //
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
                             (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
                              GPIO_PIN_1));
    
            MAP_GPIOPinTypeGPIOInput(GPIO_PORTH_BASE, GPIO_PIN_1);
               r= MAP_GPIOPinRead(GPIO_PORTH_BASE, GPIO_PIN_1);
            //   UARTprintf("GPIO_PIN_1 %i value  ",r);
    
    
                   if(r)
                   {
                   ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1);
                       MAP_GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1,
                                                GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
    
                       if(flag==1)
                      {
                       ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, 1);
                       uint8_t data1[] = { 76, 69, 68, 95, 79, 78 };
                       p = pbuf_alloc(PBUF_TRANSPORT, sizeof(data1), PBUF_RAM);
                       memcpy(p->payload, data1, sizeof(data1));
    
                       udp_send(upcb, p);
                       UARTprintf("flag %i value  ",flag);
                       flag=0;
                       }
    
                      // UdpClientInit();
                   }
    
                   if(!r)
                               {
                               ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1);
                                   MAP_GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1,
                                                            GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
    
                                   //
                                   //
                                   //
                                   ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0);
                                   pbuf_free(p);
                                   flag=1;
                               }
    
    
        }
    }
    

  • The udp example I gave you before was based on lwip 1.4.1 version while the MSP432E SimpleLink SDK uses a new version of the lwip stack. See below comparison where the left side is the udp_connect for MSP432E and the right hand side is the older 1.4.1 version. 

    And One more query If I use this Micro-controller in my design then which JTAG should I use to program it.

    You can use XDS110 which is already built into to the MSP-EXP432E401Y LaunchPad. If you want to use an external debug probe, you can use popular and low cost probes like XDS110 and XDS200. See below supported probes. The ones highlighted in yellow are the popular ones.