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.

TMDSCNCD28388D: LWIP Example Project

Part Number: TMDSCNCD28388D
Other Parts Discussed in Thread: C2000WARE

Hi,

I'm testing the enet_lwip example project in the F28388D controlCARD evaluation (TMDSCNCD28388D). The webserver works, I can see the “lwIP - Interactive Example” web page and the webserver responds to the GET requests.


But verifying the application in depth, I'm facing the following problems:

- it is not clear because the variable “systickPeriodValue” is set to 15000000; in the Concerto library the system timer interrupt period was set to 10ms. In the example, the variable “systickPeriodValue” is used for the system timer interrupt period and to update the lwIP Ethernet timer by the lwIPTimer function. Supposing the CM clock frequency is 125MHz (I do not know which c28x1 project is used, so I do not know the system clock configurations),  the system timer interrupt period is 120ms and the lwIP Ethernet timer is incremented with the systickPeriodValue value.

- if I add the DEBUG symbol in the CCS “Predefined Symbols” window to enable the LWIP_PLATFORM_ASSERT macro, the application stops in the “Error handling function”. The lwip stack expected that the Ethernet_Pkt_Desc structures (pktDescriptorRXCustom) are allocated in the HEAP RAM.In the example, pktDescriptorRXCustom is a global array.

Moreover it is not clear for me why it is necessary to use the custom callback functions in this example

    //
    // Assign the callbacks for Getting packet buffer when needed
    // Releasing the TxPacketBuffer on Transmit interrupt callbacks
    // Receive packet callback on Receive packet completion interrupt
    //
    pInitCfg->pfcbRxPacket = &Ethernet_receivePacketCallbackCustom;
    pInitCfg->pfcbGetPacket = &Ethernet_getPacketBufferCustom;
    pInitCfg->pfcbFreePacket = &Ethernet_releaseTxPacketBufferCustom;


- if I continually reload the webpage (for instance, keeping pressed CTRL+R buttons to reload the page on Firefox browser) the webserver crashes. I observed that many “three-way handshake” during the TCP connections remain pending causing TCP retransmission packets on both sides (client, server).

I understand the enet_lwip project is only an example and the application improvement is a developer care but any help is really appreciated.

Thanks in advance,

Fil

PS
I’m using the following library and IDE:
C2000Ware_2_01_00_00
CCS 9.2.0.00013

  • Hi,

    filids said:
    it is not clear because the variable “systickPeriodValue” is set to 15000000

    Not sure what is not clear to you. What is your question?

    filids said:
    if I add the DEBUG symbol in the CCS “Predefined Symbols” window to enable the LWIP_PLATFORM_ASSERT macro, the application stops in the “Error handling function”

    When does that happen, can you let me know the call stack in that time?

    filids said:
    it is not clear for me why it is necessary to use the custom callback functions in this example

    The call backs provided in the low level driver in ethernet.c are for reference.The callbacks are called whenever a packet arrives/a packet is freed up or needed from the application. This LWIP application needs some specific actions packet arrives, etc hence uses these callbacks which are custom for this application.

    filids said:
    I understand the enet_lwip project is only an example and the application improvement is a developer care but any help is really appreciated.

    As you rigthly said it is only a reference example and we have not done extensive testing like continuous Ctrl+R. 

    Regards,

    Sudharsanan

  • Hello Sudharsanan,
    thanks for your quick response.

    The first issue is not a big deal. I wanted to signal that systickPeriodValue is used for the system timer configuration and for the lwIPTimer function

    SYSTICK_setPeriod(systickPeriodValue);

    lwIPTimer(systickPeriodValue);


    but I would use


    lwIPTimer(120);
    with CM_CPU_CLOCK = 125MHz

    I send you the call stack

    Thanks,

    Fil

  • Hi Fil, 

    Thanks for the note about systickPeriodValue. We shall fix it in upcoming release.

    Thanks for the call trace. I could not recreate it yet at my end. I shall get back within a couple of weeks. 

    Regards,

    Sudharsanan

  • Hi,

    Apologize for the delay. I tried to recreate the scenario for the error you mentioned. I recompiled the application with LWIP_DEBUG defined, I see the HTTP webserver example working fine without issues. I did not see a halt as you mentioned. 

    Is there any specific step I need to do to recreate the issue? 

    Regards,

    Sudharsanan

  • Hi Sudharsanan,

    I send you the enet_lwip project.

    As you can see on the project settings, I defined "DEBUG", to enable the assert condition.

    <listOptionValue builtIn="false" value="DEBUG"/>

    Thanks for your help.

    Regards,

    Filenet_lwip.zip

  • Hi Fil,

    Thanks for the additional details and the project. 

    I could recreate the issue at my end. It is due to the fact that when DEBUG macro is enabled the mem_free encounters first ASSERT which results in this error.it gets stuck at this line LWIP_MEM_ILLEGAL_FREE("mem_free: illegal memory"); Since __error__ is defined in pinout.c as__asm("   bkpt #0"); instruction.That causes it to halt. 

    With default configuration without DEBUG defined, these functions are called but does not result in a halt(since LWIP_PLATFORM_ASSERT is not defined), the status is just incremented application continues to run.

    Actually the Error function is a place holder, you may implement any handler to handle the errors.

    Hope it helps. 

    Regards,

    Sudharsanan