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.

TMS320F28388D: HTTP Webserver (without RTOS) using TMS320F28388D

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE, TMDSCNCD28388D

Dear TI,

we are going use TMS320F28388D for our VFD application.

The main aim to use this controller was to incorporate Modbus TCP functionality in our product using the inbuilt ethernet interface of the controller.

For implementation support of Modbus-TCP, we refered Ethernet modules example code "LWIP HTTP Webserver Example" present in "C2000Ware_3_03_00_00_setup.exe".

After working on it for couple of days, we found it difficult to port in our existing application and moreover we can't get any detailed documentation on it.

So please provide simplified and easy to port example code for http webserver application without RTOS.

Regards,

Amtech

  • Hi,

    The Webserver application is just an example to demonstrate the LWIP stack ported onto F2838x. It is not meant to be used for any kind of application on LWIP. 

    Can you please elaborate your use case a bit more? Are you planning to run a webserver or different use case?

    Regards,

    Sudharsanan

  • Hello,

    We are planning to developed Modbus TCP server for our application to interface with PLC and Scada using Ethernet connectivity.

    So can you provide any simplified software stack for the same. 

    We also found that, during testing of "LWIP HTTP Webserver Example" present in "C2000Ware_3_03_00_00_setup.exe" with TMDSCNCD28388D kit, it does not respond every time and gives error of host unreachable.

    Regards,

    Amtech

  • Hi,

    Please use the latest version of C2000Ware C2000Ware_3_04_00_00.

    You can configure the lwipopts.h file at location C2000Ware_3_04_00_00\libraries\communications\Ethernet\third_party\lwip\examples\enet_lwip\cm to appropriately enable or disable the protocols or features supported by the lwIP stack. It also has memory size parameters for the stack which can be configured. These should help you simplify the stack. Currently we only provide lwIP stack withou RTOS. You can also refer to NDK stack which requires RTOS (C2000Ware_3_04_00_00\libraries\communications\Ethernet\ti\ndk\examples\tcpEchoF2838X). 

    Regards,

    Yashwant 

  • Dear Yashwant / Sudharsanan,

    As per your suggestion, I used C2000Ware_3_04_00_00.

    The connection loss issue in the http_webserver example remains unresolved. I couldn't get the ping response continuously. After referring, others posts related to Ethernet issues, I checked the EthernetRxInterruptCount. It increases continuously but the reply comes at random.

    Moreover, the lwip_stats register response is also shown in the attached snapshot for your ready reference. I also monitored, the RxStatistics present at 0x400c0800 in the memory. I couldn't see any modification in its value.

    Moreover sometimes, the ping response comes continuous when I reset-restart both CPU1 and CM. However, it has also been observed that after some continuous query (ping), again the network goes down.

    I don't know where I did wrong. Could you kindly point out?

    After detailed observation in the lwip_stats.IP, I could see the major route cause for dropping of the packets was lwip_stats.ip.lenerr and lwip_stats.ip.proterr.

    In addition to this, i require the connection to remain alive i.e. connection should not be closed on each request. Can you suggest a place to update for the same, too?

    For keeping connection alive, I tried the keep_alive macros and but couldn't get success.

    Regards,

    Amtech

  • Dear Yashwant / Sudharsanan,

    In http web_server example code, port number is provided during initialization via "httpd_init_pcb(pcb, HTTPD_SERVER_PORT);" in httpd_init() routine called from main().

    Can you provide a way on how to change the Port number (HTTPD_SERVER_PORT) dynamically without restarting the CM? Also how to free the dynamically allocated memory in pbuf and other structures?

    Note that whether the user has changed the port or not can be identified from the main() routine and not from the routines of LwIP stacks.

    In addition to this, the provided stack in the http_web_server example code, consumers lot of memory (specifically RAM), leaving less memory for other applications. So how can we optimize the memory? Our application layer shall have maximum 200 bytes in one response. So how to change the lwipopts.h file parameter for this settings.

    We are planning to use all the available peripherals in the TMS320F28388D for our application. In this case we shall face memory constraint if we go with this parameters settings and stack.

    I had came across uIP stack with lower memory footprint. Is there any example code of http_webserver for TMS320F28388D with uIP stack?

    Regards,

    Amtech

  • Hi,

    Ethernet is only accessible through CM or Cortex M4 so the other control peripherals and ADC have to accessed through C28x CPU which are not effected by the memory consumption of CM.

    Can you share what all things are planned to be used through CM.

    Regarding the discontinuous ping response, we are looking into it and will get back to you shortly. 

    Regards,

    Yashwant

  • Hello Yashwant,

     Thanks for your prompt reply.

    The below questions are left unanswered. So could you point out the issues responsible for the below cases.

    1. Issue related to lwip.ip.lenerr and lwip.ip.proterr count increment? As mentioned in previous post, when ping response goes, this parameters are observed to increment and highlighted by the stack as the cause of response lost.

    2. I require the connection to remain alive i.e. connection should not be closed on each request. Can you suggest a place to update for the same, too?
    Also take the note that, for keeping connection alive, I tried the keep_alive macros and but couldn't get success.

    3. Can you provide a way on how to change the Port number (HTTPD_SERVER_PORT) dynamically without restarting the CM?
    Note that whether the user had changed the port or not can be identified from the main() routine and not from the routines of LwIP stacks.

    4. How to free the dynamically allocated memory in pbuf and other structures in case of re-initialization from main()? In short how to restart the Ethernet module with stack without resetting the CM?

    5. Our application layer shall have maximum 200 bytes in one response. So could you suggest how to change the lwipopts.h file parameter for this settings. In this way, the memory footprint can be optimized to some extend.

    6. I had came across uIP stack with lower memory footprint. Is there any example code of http_webserver for TMS320F28388D with uIP stack?

    As requested by you in your last reply, regarding what all things are planned to be used through CM, I am planning to implement Modbus TCP server using Ethernet module. Apart from this we had also planned to use CM UART for Modbus serial master and slave (configurable dynamically from external parameters received at any point of time), USB for data-logging and firmware upload and CM-I2C for external IC interface. Other supported modules might be added in future too. Moreover, all the modules supported by CM are planned to be used simultaneously (in parallel). 

    Regards,

    Amtech

  • For your queries regarding lwIP can you post them in some open source forum for lwIP as we too have limited understanding of it. 

    If you are expecting less packet size then you can reduce the ETHERNET_MAX_PACKET_LENGTH and ETHERNET_NO_OF_RX_PACKETS value as per your requirements which will reduce the RAM usage. You can also update the MEM_SIZE macro in lwipopts.h to reduce RAM usage.

    Regarding uIP we currently dont have a port available for that stack. 

    We are still in the process of understanding why lwip.ip.lenerr and lwip.ip.proterr count are increment. 

    Regards,

    Yashwant 

  • Dear Yashwant,

    Can you provide some timeline by which we can expect the resolution of the connection loss issue?

    Regards,

    Amtech

  • Dear Yashwant / Sudharsanan,

    I am working on implementation of Modbus TCP server.

    It has been observed that the "Data Length" field received from the IP header and the p->len, p->tot_len parameter updated by the code, are different. This is not always the case. But when the reply goes, most of the time the reason encountered is the length issue in ip section.

    For an already established connection, I have also observed in Wireshark that once the external client sends a FIN flag packet, and opens a new connection on new port, the server is unable to cop-up with it and tries attempt re-transmission for the previous connections. Moreover, new connection is also closed and re-transmission is attempted.

    Is there any way to close or kill all the pending connections apart from the newly established one and disable re-transmission on receiving FIN flag. I don't want the new connection to be closed, only the pending connections need to be closed.

    Regards,

    Amtech

  • Hi,

    Can you try updating a line in f2838xif.c file

    p->len = pPacket->pktLength; to p->len = 1538; in the f2838xif_receive function.

    which is essentially not relying on the length set by low level driver but setting it to max possible received packet size.

    Regards,

    Yashwant