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.

Integrating lwip from example

Hello,

I've gotten the lwip example to work on the Concerto F28M35H52C1 controlCard. It acquires an IP address with DHCP and serves the web page.

However, when I try copying over that code and integrating into an existing project, it longer works. It no longer shows up on the router.

Is there some configuration I am missing? I have looked through the code, the linker file, and the project settings, and am not finding any difference.


After copying over the relevant code, and commenting out the pre-existing code, I am left with this in main.c:

#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_sysctl.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/interrupt.h"
#include "utils/locator.h"
#include "utils/lwiplib.h"
#include "httpserver_raw/httpd.h"
#include "lwip/new_set_pinout_f28m35x.h"

void lwIPHostTimerHandler(void)
{
    // Get the local IP address.
//    ulIPAddress = lwIPLocalIPAddrGet();
}

void SysTickIntHandler(void)
{
    // Call the lwIP timer handler.
    lwIPTimer(SYSTICKMS);
}

void main(void)
{
    // Disable Protection
    HWREG(SYSCTL_MWRALLOW) =  0xA5A5A5A5;

    // Sets up PLL, M3 running at 75MHz and C28 running at 150MHz
    SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xF) |
            SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_2 |
            SYSCTL_XCLKDIV_4);
   
    PinoutSet2();  // Setup pinouts for ethernet
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);


    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    // Call Flash Initialization to setup flash waitstates
    // This function must reside in RAM
    FlashInit();
    
    SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
    SysCtlPeripheralReset(SYSCTL_PERIPH_ETH);

    SysTickPeriodSet(SysCtlClockGet(SYSTEM_CLOCK_SPEED) / SYSTICKHZ);
    SysTickEnable();
    IntRegister(FAULT_SYSTICK, SysTickIntHandler);
    SysTickIntEnable();

    // Disable clock supply for the watchdog modules
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
    SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);

    // Enable processor interrupts.
    IntMasterEnable();

    static unsigned long ulUser0, ulUser1;
        // 0x00 MACOCT3 MACOCT2 MACOCT1
        ulUser0 = 0x00F263A8;

        // 0x00 MACOCT6 MACOCT5 MACOCT4
        ulUser1 = 0x00391000;

        //
        // 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.
        //
        unsigned char pucMACArray[8];
        pucMACArray[0] = ((ulUser0 >>  0) & 0xff);
        pucMACArray[1] = ((ulUser0 >>  8) & 0xff);
        pucMACArray[2] = ((ulUser0 >> 16) & 0xff);
        pucMACArray[3] = ((ulUser1 >>  0) & 0xff);
        pucMACArray[4] = ((ulUser1 >>  8) & 0xff);
        pucMACArray[5] = ((ulUser1 >> 16) & 0xff);

        // Initialze the lwIP library, using DHCP.
        lwIPInit(pucMACArray, 0, 0, 0, IPADDR_USE_DHCP);

        // Setup the device locator service.
        LocatorInit();
        LocatorMACAddrSet(pucMACArray);
        LocatorAppTitleSet("EK-LM3S9B92 enet_lwip");

        // Initialize a sample httpd server.
        httpd_init();

    while(1)
    {

    }
}


I also moved .bss to S0 and increased its size to 0xA000. I also increased the stack size to 1024 on the project configuration page.

Am I missing anything else? I think this should be all the code necessary. The project builds and deploys successfully, it just doesn't work.

  • I tried creating a blank project to test the code. I copied over all the files (and linked files) from the enet_lwip example, including the main file. I added include paths, and changed the stack size to 1024.

    The project doesn't work. So there must be some hidden configuration or settings on the enet_lwip example that are required for it to work. Any idea what that might be?

  • Has anyone successfully integrated lwip into their projects? Is there something that I'm missing?