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.

LWIP PROBLEM IN TM4C

Other Parts Discussed in Thread: EK-TM4C1294XL

Hello,

I am using TM4C controller to send data to pc using static ip and working properly.But if i ping from my PC while sending out data its not working (after that no udp packets) in wireshark,why its occuring,how to solve it,weather its re-entrant  problem of lwip?.

Any forum member please replay..........

Regards,

Krishnan

  • Do U have a proper binding to some UDP port on the TCP transport? Ping response from Host TM4C requires U to enable ICMP in (Lwipopts.h)
  • Windows fire wall may be blocking incoming UDP port or out going ICMP response?
  • Hello,

    Thank you for the information ,My problem is still exixting even after i changed lwipopts.h ,icmp configuration.

    Actually i am sending out UDP packets out properly but when i am trying to ping pc and tiva while sending udp packts ping is not occuring and after that udp is also not coming out....................

    Any suggestions plesae  help,its so necessary........

    //*****************************************************************************
    int main(void)

    {

    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);


    //
    // 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] = 0x01;
    pui8MACArray[1] = 0x02;
    pui8MACArray[2] = 0x03;
    pui8MACArray[3] = 0x01;
    pui8MACArray[4] = 0x02;
    pui8MACArray[5] = 0x03;

    lwIPInit(g_ui32SysClock,pui8MACArray,sourceaddr,netmask,gateway,IPADDR_USE_STATIC);

    LocatorInit();
    LocatorMACAddrSet(pui8MACArray);

    udp_init();

    struct udp_pcb * mypcb;
    mypcb = udp_new();
    if (mypcb == NULL)
    {
    UARTprintf("udp failed.\n");
    }
    else
    {
    UARTprintf("udp up.\n");
    }

    if (udp_bind(mypcb, IP_ADDR_ANY, 8760) != ERR_OK)
    {
    UARTprintf("udp bind failed.\n");
    }
    pbuf1 = pbuf_alloc(PBUF_TRANSPORT, 8200, PBUF_RAM);


    /*MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
    MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);*/
    //static int n = 0;
    while(1)
    {

    pbuf1->payload = (void*)&bval;
    pbuf1->tot_len = 8149;
    pbuf1->len = 8149;
    //buf[0] = 0x10;
    // buf[1] = 0;
    //usprintf(&buf[4], " hi karthi %d", n++);
    //IP4_ADDR(&udpDestIpAddr,172,17,2,30);


    fpga_read();
    IP4_ADDR(&udpDestIpAddr,172,17,2,30);

    udp_sendto(mypcb, pbuf1,&udpDestIpAddr,1001);
    pbuf_free(pbuf1);


    }


    }

    Regards,

    Krishnan

  • Have you assigned an UDP port to the client?

    TCP has connectionless transmit points and IP dedicated port on receiver. UPD client requires a specified port dedicated as the connected end point or ICMP on the Host will not send back a echo response.

    //*****************************************************************************
    //
    //! The port to use for TCP connections for the Motor Drive UI protocol.
    //
    //*****************************************************************************
    #ifndef UI_PROTO_PORT
    #define UI_PROTO_PORT           23
    #endif
    
    //*****************************************************************************
    //
    //! The port to use for UDP connections for the Motor Drive UI protocol.
    //! (This port is used for query purposes only).
    //
    //*****************************************************************************
    #ifndef UI_QUERY_PORT
    #define UI_QUERY_PORT           23
    #endif
    //
    ********************************************************************************
    
           //
           // Initialize the application to listen on the UDP telnet port.
           //
           pcb = tcp_new();
           tcp_bind(pcb, IP_ADDR_ANY, UI_PROTO_PORT);
           pcb = tcp_listen(pcb);
           tcp_accept(pcb, UIEthernetAccept);
    
           //
           // Initialize the application to listen for UDP packets on the telnet
           // port (for device query only).
           //
           pcb = udp_new();
           udp_recv(pcb, UIEthernetReceiveUDP, NULL);
           udp_bind(pcb, IP_ADDR_ANY, UI_QUERY_PORT);
           udp_connect(pcb, IP_ADDR_ANY, UI_QUERY_PORT);

  • Hello,
    Actually i am assigning static IP TO MY BOARD(TIVA) AND CRAETINA A PORT AND BINDING "Udp_bind(mypcb, IP_ADDR_ANY, 8760) !"
    SENDING DATA OUT USING "IP4_ADDR(&udpDestIpAddr,172,17,2,30);

    udp_sendto(mypcb, pbuf1,&udpDestIpAddr,1001);"

    Any other configurations required ,i am happy for the guidance

    or else weather i have to bind the sender port like before using
    udp_sendto(mypcb, pbuf1,&udpDestIpAddr,1001);" bind udpDestIpAddr,172,17,2,30 to 1001...............ok i will check it and replay




    But when i tried the code below earlier i was not able to send out packets ,just go through if possible dont feel as a disturbance...........



    2)

    // UDP initialization ......................................
    void my_udp_tx(u8_t *data, u16_t len)
    {
    if (g_upcb->remote_port != (uint16_t)0)
    {
    struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT,
    len, PBUF_RAM);
    memcpy(p->payload, data, len);
    IP4_ADDR(&udpDestIpAddr,172,17,2,30);
    udp_sendto(g_upcb, p,&udpDestIpAddr,1001);
    //udp_send(g_upcb, p);
    pbuf_free(p);
    }
    }
    void my_udp_rx(void *arg, struct udp_pcb *upcb,struct pbuf *p, struct ip_addr *addr, u16_t port)
    {
    u8_t buf[145];
    int i;
    for(i=0;i<45;i++)
    {
    buf[i]=i;
    }
    /* process the payload in p->payload */
    my_udp_tx(buf,145);
    // udp_connect(upcb, addr, port); /* connect to the remote host */
    pbuf_free(p); /* don't leak the pbuf! */
    }
    void my_udp_init(void)
    {
    g_upcb = udp_new();
    udp_bind(g_upcb, IP_ADDR_ANY, 777);
    udp_recv(g_upcb, &my_udp_rx, (void *)0);
    }



    Please replay,
    Regards,
    Krishnan
  •  

    Hi Krishnan,

    Quote: 

    >>(udp_bind(mypcb, IP_ADDR_ANY, 8760) != ERR_OK)

    Quote:

    >>udp_sendto(mypcb, pbuf1,&udpDestIpAddr,1001);"

    We know in UDP world both receiver and transmitter have to be on the same (connected) UDP port. That is not true for (connectionless) IP ports,  TCP (LWIP stack) is only the transport for both IP & UDP ports. 

    Might I suggest to use telnet port 23 for both client & host until you get your code working. On PC side use telnet.exe in shell window (Run / cmd) and try to connect to the Tiva UDP (pcb 23). Very simple test to know if Tiva is accepting a UDP connection, if telnet stays connected and enters the (TTY) shell mode. If telnet immediately disconnects port 23 then there is no listening UDP binding. The ICMP response to pinging Tiva from PC will not echo back, do check Windows allows ICMP response messages in firewalls configuration for the public interface. 

    Hope this explanation of difference between IP & UDP connections helps?

    Please be sure to check question answered if this has helped!

     

  • Hi Krishnan,
    Sorry if I confused you/me about telnet - was thinking it was UDP port only when it is actually both TCP/UDP. Microsoft Ping as I recall is TCP based though often net scan tools & modems offer a UDP ping tool. ICMP echo TCP/UDP port 7 has to be listening on the host pinged and UDP.

    Recall Telnet - host only listens on TCP 23 (tcp_bind) for client connections data packets than switches to connectionless UDP 23 to listen for commands in data packet transfers. The Doxygen text top post is incorrect to say that was a UDP listen port when it has a (tcp_bind) . ;-)

    Would it not be easier to configure a TCP/UDP connection binding like Telnet order to test your TM4C EMAC ports?

  • Hello,
    i am not that much aware of protocols,but with my code i am able to send out packets but when i ping while i send out packetsit will crash no packts will come out that is my problem
    .
    What i am assuming is lwip is not reentrant and using eheernet interrupt handler weather it will be the reason to crash......

    Thanking for message and help ,i will also cjheck with telnet,


    Regards,
    Krishnan
  • Exactly correct LWIP is not reentrant and needs a periodic timer call configured using SYSTIC interrupt or other timer to (trigger) the LWIPtimer() interrupt - call to internal LWIP timers.  Likely will crash LWIP or TM4C without a timer interrupt handler call to function, trigger for LWIP timers.

    May need to reset the EMAC after  you make changes to LWIP configuration such as binding UDP/TCP/IP ports,  MAC & IP address assignments.



    HWREG(SYSCTL_MOSCCTL) = SYSCTL_MOSC_HIGHFREQ; // // Run from the PLL at 120 MHz, previous setting XTAL HIGHFREQ . // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
    // // Initialize lwIP with the system clock, MAC and use DHCP. // lwIPInit(ui32SysClock, g_sEnet.pui8MACAddr, 0, 0, 0, IPADDR_USE_DHCP);
    //! Configure SysTick 600kHz 1.6us periodic interrupt for the user functions.
        //! EthernetSendRealTimeData() is called by SysTickIntHandler()
        ROM_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ); //SYSTICKHZ=200
        ROM_SysTickEnable();
        ROM_SysTickIntEnable();
    
    ************************************************************************* // //Configure interrupt handler function name in (startup_CCS.c) //Periodic system tick to make configuration calls/changes etc.. // void SystickIntHandler(void) { // // Call the lwIP UDP/HTTP timer handler. // lwIPTimer(200); //Periodic LWIP(200ms)
  • Hello,

    thank you for the message, i will test and replay the updated status.

    Regards,

    Krishnan

  • Hi Krishnan,

    Recently came across this hidden configuration that allows ping to reply in LWIP version 1.4.1. When  broadcast and multicast == 0 - ping will then respond to Microsoft ping defaulting to unicast mode. Hope this helps and recently discovered LWIP_UDP may not have to be enabled in order to broadcast packets on TCP into a UDP user data port. At least with DNS query, recall reading the RFC first attempts to resolve using  connectionless UDP broadcast then switches to IP after that mode fails.

    //*****************************************************************************
    //
    // ---------- ICMP options ----------
    //
    //*****************************************************************************
    #define LWIP_ICMP                       1
    //#define ICMP_TTL                       (IP_DEFAULT_TTL)
    #define LWIP_BROADCAST_PING             0 // Respond to broadcast pings (default is unicast only)
    #define LWIP_MULTICAST_PING             0 // Respond to multicast pings (default is unicast only)

     

  • Hello,

    Thank you for the message  and sorry for the delay ,i tried this option today in windows

    #define LWIP_ICMP                       1
    //#define ICMP_TTL                       (IP_DEFAULT_TTL)
    #define LWIP_BROADCAST_PING             0 // Respond to broadcast pings (default is unicast only)
    #define LWIP_MULTICAST_PING             0 // Respond to multicast pings (default is unicast only)


    but ping is not replaying(host unreachable) no change to previous stage

     One more doubt i have ,i am using LWIP Static ip,after lwip initialiozation i used

    //
    // Enable and reset the Ethernet modules.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EMAC0);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EPHY0);
    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_EMAC0);
    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_EPHY0);

    Then packets are not coming out,

    I am ataching my projrct folder can u please suggest me how can i avoid reentrancy problem of lwip.Like were to bring interrupt handler how to use it...,i am a beginner so please help if possible...........enet_io.zip

     

     

     

    Thankyou,

    Regards,

    Krishnan

  • Quote: "i tried this option today in windows"

    Thoes setting should be put in LWIP (lwipopt.h), discovered some setting are overrides of a few settings  found in (opt.h). When using the LWIP TCP stack all the EMAC initialization is done in (lwiplib.c) provided by TI in many example projects . (lwiplib.c) calls functions for configuration parts of (tiva-tm4c1294.c) setting DMA descriptors and other things for the EMAC. Far easier to modify parts of code that already works and add your desired changes than is to start from scratch. You will actually learn more and faster how it all fits together.

    Quote "how can i avoid reentrancy problem of lwip"  

    Simply set up the SYSTICK clock code in your main app and periodically call the EthClientTick() function inside (eth_client_lwip.c) [easy] method. Harder method is to invoke parts of  (lwiplib.c) require 10ms-20ms SYSTICK interrupt handler calls to LwipTimer(),  provides an internal hardware interrupt 56 context to LWIP. U still have to set the EMAC priority to (E0 or C0) in your main app. LWIP takes care of reentrance by incrementing its own internal timers for DHCP/DNS/TCP incrementing counters from strobe - SYSTICK.

    Look thought the code - it's not so difficult to follow.

  • Sir,
    I tried my configurations in lwipopts.h files only ,I am not using the configurations any were else.

    In the enet_lwip example
    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTickIntHandler(void)
    {
    //
    // Call the lwIP timer handler.
    //
    lwIPTimer(SYSTICKMS);
    }

    is used were lwIPTimer(SYSTICKMS) will be called in lwiplib.c
    Emac prority i am already using in my code.

    "periodically call the EthClientTick() function inside (eth_client_lwip.c) " - please provide a better idea,i will follow the code parallely and will update the status.

    Thankyou,
    Regards,
    Krishnan
  • Hello Sir,

    Now I clearly understood the scenario i am putting my understanding

    From,

    1)SysTickIntHandler(void) we will move to  lwIPTimer(SYSTICKMS);

    2)From  lwIPTimer(SYSTICKMS)  to lwIPTimer which will generate  an ethernet interrupt.

    3)lwIPEthernetIntHandler(void) will be called when ethernet interrupt is generated.

    So, only thing i think i want to implement is to generate a systick interrupt in 20-30 ms.......is it so ,or default systick will occur,and suggest me were to create that systick function as i want to send udp data out continuesly.

    My main code is as below


    //
    // This is part of revision 2.1.0.12573 of the EK-TM4C1294XL Firmware Package.
    //
    //*****************************************************************************
    #include <stdbool.h>
    #include <stdint.h>
    #include <string.h>
    #include <stdlib.h>
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_nvic.h"
    #include "inc/hw_types.h"
    #include "driverlib/flash.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/systick.h"
    #include "driverlib/timer.h"
    #include "driverlib/rom_map.h"
    #include "utils/locator.h"
    #include "utils/lwiplib.h"
    #include "utils/uartstdio.h"
    #include "utils/ustdlib.h"
    #include "httpserver_raw/httpd.h"
    #include "drivers/pinout.h"
    #include "io.h"
    #include "cgifuncs.h"
    #include "lwip/inet.h"

    //*****************************************************************************


    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    #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

    //struct ip_addr *udpDestIpAddr;
    uint32_t sourceaddr, netmask,gateway;
    struct ip_addr udpDestIpAddr;

    //*****************************************************************************
    //
    // A set of flags. The flag bits are defined as follows:
    //
    // 0 -> An indicator that the animation timer interrupt has occurred.
    //
    //*****************************************************************************
    #define FLAG_TICK 0
    static volatile unsigned long g_ulFlags;

    //*****************************************************************************
    //
    // External Application references.
    //
    //*****************************************************************************

    extern void udp_init(void);

    //*****************************************************************************
    //
    // The current IP address.
    //
    //*****************************************************************************
    uint32_t g_ui32IPAddress;

    //*****************************************************************************
    //
    // The system clock frequency. Used by the SD card driver.
    //
    //*****************************************************************************
    uint32_t g_ui32SysClock;

    struct udp_pcb *my_pcb;
    struct pbuf* pbuf1;
    char buf [120];

    //*****************************************************************************
    //
    // The error routine that is called if the driver library encounters an error.
    //
    //*****************************************************************************
    #ifdef DEBUG
    void
    __error__(char *pcFilename, uint32_t ui32Line)
    {
    }
    #endif

    //*****************************************************************************
    //
    // The interrupt handler for the SysTick interrupt.
    //
    //*****************************************************************************
    void
    SysTickIntHandler(void)
    {
    //
    // Call the lwIP timer handler.
    //
    lwIPTimer(SYSTICKMS);
    }


    //*****************************************************************************
    //
    // 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 ui32Idx, 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("\n");
    UARTprintf("Open 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))
    {
    //
    // Loop through the LED animation.
    //

    for(ui32Idx = 1; ui32Idx < 100; ui32Idx++) //was < 17
    {

    //
    // Toggle the GPIO
    //
    MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
    (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
    GPIO_PIN_1));

    SysCtlDelay(g_ui32SysClock/(ui32Idx << 1));

    }
    }
    }

    //*****************************************************************************
    //
    // This example demonstrates the use of the Ethernet Controller and lwIP
    // TCP/IP stack to control various peripherals on the board via a web
    // browser.
    //
    //*****************************************************************************
    int main(void)
    {

    uint8_t pui8MACArray[8];
    //struct udp_pcb *socketfd = NULL;

    //
    // 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 debug port for internal use.
    //
    UARTStdioConfig(0, 115200, g_ui32SysClock);

    //
    // Clear the terminal and print a banner.
    //
    UARTprintf("\033[2J\033[H");
    UARTprintf("Ethernet IO Example\n\n");


    //
    // Configure SysTick for a periodic interrupt.
    //
    MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
    MAP_SysTickEnable();
    MAP_SysTickIntEnable();

    pui8MACArray[0] = 0x01;
    pui8MACArray[1] = 0x02;
    pui8MACArray[2] = 0x03;
    pui8MACArray[3] = 0x01;
    pui8MACArray[4] = 0x02;
    pui8MACArray[5] = 0x03;

    //
    // Initialze the lwIP library, using DHCP.
    sourceaddr=inet_addr("28.1.17.172");
    netmask=inet_addr("0.0.255.255");
    gateway=inet_addr("3.0.17.172");

    lwIPInit(g_ui32SysClock,pui8MACArray,sourceaddr,netmask,gateway,IPADDR_USE_STATIC);

    //LocatorInit();
    //LocatorMACAddrSet(pui8MACArray);


    udp_init();

    struct udp_pcb * mypcb;
    mypcb = udp_new();
    if (mypcb == NULL)
    {
    UARTprintf("udp failed.\n");
    }
    else
    {
    UARTprintf("udp up.\n");
    }

    if (udp_bind(mypcb, IP_ADDR_ANY, 8760) != ERR_OK)
    {
    UARTprintf("udp bind failed.\n");
    }
    pbuf1 = pbuf_alloc(PBUF_TRANSPORT, 1024, PBUF_RAM);
    //
    // 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);

    //
    // Pass our tag information to the HTTP server.
    //

    //
    while(1)
    {

    // Transmit to UDP
    //
    static int n = 0;
    pbuf1->payload = (void*)buf;
    pbuf1->tot_len = 1024;
    pbuf1->len = 1024;
    buf[0] = 0x10;
    buf[1] = 0;
    usprintf(&buf[4], "fgggggggggggggg*****", n++);
    IP4_ADDR(&udpDestIpAddr,172,17,2,30);
    udp_sendto(mypcb, pbuf1,&udpDestIpAddr,1001);

     

    }
    pbuf_free(pbuf1);
    }

     

    Or plese tell me how to make systick int enable for lwip and udp.............

     

    Regards,

    Krishnan

  • Quote: "I tried my configurations  in lwipopts.h files only ,I am not using the configurations any were else"

    Again LWIP (opts.h) enables or disable all Ethernet default settings, many are enabled & not found in (lwipopts.h) that can set user select overrides for the defaults found in (opts.h). 

  • Sir,

    Quote:Again LWIP (opts.h) enables or disable all Ethernet default settings?

    How to overcome the issue
    (IF #define LWIP_ICMP 1
    //#define ICMP_TTL (IP_DEFAULT_TTL)
    #define LWIP_BROADCAST_PING 0 // Respond to broadcast pings (default is unicast only)
    #define LWIP_MULTICAST_PING 0 // Respond to multic)

    IS NOT HELPING TO PING THE BORAD AND PC.


    Quote: Lwip Reentrancy problem

    We added systick and finded out the configuration and flow,but still i am confused how can i use ststickint handle in lwip to send out UDP AND AVOID REENTRANCY.


    Thanking for all messages,

    Regards,
    Krishnan
  • Judging by the code above your understanding is starting to take root - Systick clock source often set in (main void).

    BTW: You might consider clearing that Systick interrupt after it enters the interrupt handler! Systick can be used for other periodic function calls like blinky to add a Run LED. Systick holds the highest default interrupt priority in that it exists at the NVIC level. Assigning Systick priority sets the built in hardware Exception events handler (Fault_Systick) to Interrupt 15. So in effect Systick has no priority to be set because it holds the highest priory by design.
  • Earlier post shows the exact code needed to enable the Systick system timer -now missing in the code you posted above.

    LWIP again only increments its timers from Systick by adding (10ms) each clock cycle independently of the EMAC interrupt 56 keeping LWIP in its own interrupt context and said to be reentrant free because of that fact.
  • BTW: LWIP sets up the TCP stack for TM4C1294 thanks to TI programmers write (tiva-tm4c129.c) for DMA memory transfers. Review the code and see how it initializes the EMAC hardware using (Lwiplib.c) PrivateConfig(). Once the TCP stack is firing its timers packets will be sent and received from the PHY.

  • Ok see the Systick is now in code but missing the LWIP timer function call to the client for your UDP packet handling routines - must be put in lwIPHostTimerHandler();

    //*****************************************************************************
    //
    // This function services all of the lwIP periodic timers, including TCP and
    // Host timers.  This should be called from the lwIP context, which may be
    // the Ethernet interrupt (in the case of a non-RTOS system) or the lwIP
    // thread, in the event that an RTOS is used.
    //
    //*****************************************************************************
    #if NO_SYS
    static void
    lwIPServiceTimers(void)
    {
        //
        // Service the Eth_Client_Lwip host timer.
        //
    #if HOST_TMR_INTERVAL
        if((g_ui32LocalTimer - g_ui32HostTimer) >= HOST_TMR_INTERVAL)
        {
            g_ui32HostTimer = g_ui32LocalTimer;
            lwIPHostTimerHandler();
        }
    #endif