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.

EK-TM4C1294XL: Served Web Pages Not Deterministic, Modifications to Web Files Probably Cause

Part Number: EK-TM4C1294XL

We have developed a product using the TM4C1294 LAN with a web server based on the enet_s2e example design.

We have customized the web pages that were in the example design for our company colors and product images and removed some unused features.

I have noticed that the served web page is not repeatable with what I am guessing are CCS style changes on reload or page navigation. And some times actual errors occur on the page content where we get the HTML 200 data in the web page. Some times the navigation changes where I select a menu items and rather than the selected web page loading into the normal main index.htm region the browser gets just the selected page and looses the navigation of the index.html.

I will attache a screen shot later.

Would like some ideas for troubleshooting.

Would like some ideas for wireshark setup to capture such errors. I have tried some wire shark captures but am rather amateurish at setting up filters. So far I have not found any insight from my capture efforts. 

I never saw such errors in the example project and assume it is something I have done.  I have not gone back to the reference enet_s2e project to try "break" it by adding our web page changes into in incrementally.

IIRC, I have some what larger image files than the example project had.

The errors happen in Firefox 66.0.4 64 bit and on IE.  I think IE is much more prone to errors.

  • Example of bad page load with the HTTP protocol showing.

  • Trying to attach an AVI.

    Click here to play this video

    This AVI shows the web page font size changing as I select menu items or refresh the main page.

    At about 46 seconds you see the font change and then the navigation failure where the Overview page loaded as the whole page not as in insert into the index.htm page.

  • I made a wireshark capture on an event where the font changed from the normal San Serf to a fount with Serf.

    I found that the CSS file was corrupted with ?HTTP transport? data.

    Should have been:

    /* Copyright (c) 2016-2019 Spectrum Techniques LLC.  All rights reserved. */
    
    /* Styling for the entire document. */
    ......

    Was:

    HTTP/1.0 200 OK
    Server: lwIP/1.3.2 (www.sics.se/.../)
    Content-type: text/css
    
    /* Copyright (c) 2016-2019 Spectrum Techniques LLC.  All rights reserved. */
    
    /* Styling for the entire document. */
    ...

    It is as if the browser did not distinguish the end of the HTTP protocol from the start of the style.css file.

  • Attaching PDF with wireshark screen shots.

    LANWebMessUp.pdf

  • Hi Forrest,
    I understand what you are describing but I'm unable to offer any hints. However, I have some questions.
    1. What if you click each menu item slower? Does it make a difference? i.e. click each item every few seconds. This is to test if it might be related to the throughput. I'm just thinking wild here to isolate the problem.
    2. Do you have a switch in between or is the MCU directly connected to the PC? What if you do one way or the other. Does it make a difference?
    3. You mentioned the IE is more prone to the problem than FireFox. What about Chrome? I will suppose all browsers to have the similar effects.
    4. I don't know how much difference is your project different from the enet_s2e. I don't know if it is simple enough (not sure what else you need to modify in other area of the code) for you to copy your fs directory to the enet_s2e and run the example. Can you repeat the same problem?
  • Hello Charles and thanks for asking questions.

    Regarding:

    1. What if you click each menu item slower? Does it make a difference? i.e. click each item every few seconds. This is to test if it might be related to the throughput. I'm just thinking wild here to isolate the problem.

    Speed does not appear to be an issue. Once I click enough the error happens, but the exact number of clicks is not repeatable. I will try clicking very slowly and see.

    2. Do you have a switch in between or is the MCU directly connected to the PC? What if you do one way or the other. Does it make a difference?

    My PC and the Launchpad are connected to a switch. I confess I have not tested our product with the direct connection to a PC. Something I should do anyway.


    3. You mentioned the IE is more prone to the problem than FireFox. What about Chrome? I will suppose all browsers to have the similar effects.

    I have not installed chrome on my PC at this time.


    4. I don't know how much difference is your project different from the enet_s2e. I don't know if it is simple enough (not sure what else you need to modify in other area of the code) for you to copy your fs directory to the enet_s2e and run the example. Can you repeat the same problem?"

    I was thinknig of doing the copy experiment. Not sure if I was going to copy the enet_s2e files into our project or our files into the example. Could imagine I end up trying both ways. But I was hoping someone had experience and might advise me of known pits into which others have fallen.

    I was also trying to read some of the project source and find the HTTP server where it is sending out (writing out) the respond code, "200", and then the data, "index.htm" and see if they were handled by the same pointer which might not get updated for some reason.  I have not found the server write functions yet.  Hopping to put break points into the code once I find candidate locations.

    Further bulletins as events warrant.

    Forrest Erickson

  • Hi Forrest,
    There is the httpd.c file in the LwIP library. I think you can start with this file and place breakpoints for debug. I also wonder if there is anything to do with the allocated PBUF size. There are various #defines in the lwipopts.h related to memory. Will increasing them make a difference?
  • Tested on Chrome and same errors can happen.

  • I have read about HTTP protocol on wikipedia.  The page on HTTP header fields is most helpfull:

    Now I can better describe the error.  The lwip http server is making an error by repeating the response header fields in the body of and at the top of the HTML document

    The normal termination of the header field is two consecutive CR LF pares and is correct.  See attached screen shot.

    The error seams to be the concatenation, duplication,  of the response header field to the beginning of the HTML document that is sent after the header. When this happens to the styles.css the fonts go bad on the displayed web page.  I assume when this happens to the JS files the functions which manage the menu break and the selected menu idem loads a whole new page rather than loading the selected page into the body of the index.htm page.

    Next to find the root cause.

  • I have swapped the file system header file between the enet_s2e example and our product project (the ST365).

    Our product project serves the example file system with out error.

    The example project enet_s2e serves our modified web files with errors.  The problem follows the modified web files.

    In this case the Overview page loaded into the index.htm with the HTTP response header field prepended to the Overview file contents. See highlighted line above.

  • I have made a few more experiments.
    I removed all the image files from our project. They may have been bigger than the example images. Regardless they are the largest fils and are gone. I rebuilt the file system and programed the Launchpad. Still the page loads (now with out images) with the same error above after a few or even one try.

    I copied the index.htm from the example project into our project. Rebuild the file system and project and programed the target. the menu was of the example but the colors were of our project and after loading web pages a few times and the effort occurred.

    Tomorrow I will try moving the styles.css.
  • I tried to localize the change to the styles.css sheet with no luck.

    So I started over. I imported into another work space, the original example project from the Tivaware folder. From C:\ti\TivaWare_C_Series-2.1.1.71\examples\boards\

    I built and loaded and ran the project on the Launchpad.  I stopped the Debugger. I pressed reset so that target was running with out debug.
    Load web page and stress tested.  I could not get it to fail.

    I made a single change to the index.htm file to make it easier to stress test and it is a change I made to our proejct web pages. i made the image in the upper left a link back to the "index.htm".

    Here is my GIT difference on the file

    Lee@Lee-PC MINGW64 ~/Documents/Tiva/workspace_v8/enet_s2e_Example (master)
    $ git diff fs/index.htm
    diff --git a/fs/index.htm b/fs/index.htm
    index cc64b0a..bc98e32 100644
    --- a/fs/index.htm
    +++ b/fs/index.htm
    @@ -14,7 +14,7 @@
           <table width="100%">
             <tr>
               <td>
    -            <a id="heading_ti" target="_" href="http://www.ti.com">
    +            <a id="heading_ti" target="_" href="index.htm">
                   <img src="ti.jpg" alt="Texas Instruments">
                 </a>
               </td>

    Lee@Lee-PC MINGW64 ~/Documents/Tiva/workspace_v8/enet_s2e_Example (master)
    $

    I build loaded into the Launchpad, ran after rest and tested this web page and it failed.


    So I have demonstrated a single change to a link in the example project will make the failure.

    Note:

    I examined the page by pressing F12.   Note the example web pages report warnings and errors:
    The script from “10.1.10.71/javascript_load.js” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type
    The Components object is deprecated. It will soon be removed. 10.1.10.71
    TypeError: document.getElementById(...) is null[Learn More] javascript_load.js:11:5
    Use of Mutation Events is deprecated. Use MutationObserver instead. eval:1:604
     
     
     
  • I changed the index.htm file with a very simple body.

    <!DOCTYPE HTML>
    <!-- Copyright (c) 2014-2015 Texas Instruments Incorporated.  All rights reserved. -->
    <html>
      <head>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
        <title>EK-TM4C1294XL Evaluation Kit</title>
        <link rel="stylesheet" type="text/css" href="styles.css"/>
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
        <script src="javascript.js" language="JavaScript1.2" charset="utf-8"></script>
        <script src="javascript_load.js" language="JavaScript1.2" charset="utf-8"></script>
      </head>
      <body>
      Some Text
      <br>
      A link <a href="index.htm" > Click here </a>
      <br>
    
      That is all.
      Some Text
      
      </body>
    </html>

    This too can fail. (The response header gets into the CSS file.)

  • Is there an expert on the LWIP HTTP Server there at TI?

    I have looked and was surprised not to find a LWIP QandA forum. It would not be the first time I failed to figure out a good search term.
  • HI Forrest,
    Sorry, unfortunately myself and others supporting TM4C don't really have expertise that understands deep enough in the LwIP stacks. If you think this is related to LwIP I will suggest contact. Again, I apologize for not being able to help much here.
  • Charles,

    FYI, I have found a lwip user group email forum at: lists.nongnu.org/.../lwip-users where I have tried to submit a description of the problem and a link to this E2E thread asking for help.

    I notice that lwip has moved on and is now at a verion 2.1.2 with new functionality.
    Would be nice if TI made a new Tiva library with this new version of lwip and of course all the examples including enet_s2e included and fully tested with lwip 2.1.2.   IIRC, there is provision for secure HTTPS.
    Perhaps you can pass this request up the chain of command at TI.

  • Hi Forrest,
    I will take note of your request. However, in the short term there is no plan to release a new version of the TivaWare and migrating to the latest LwIP.
    I hope you are getting some resolution from the LwIP forum and please do update this thread if the problem you are having is related to the LwIP version.
  • Got an interesting observation from my post: lists.nongnu.org/.../msg00020.html

    Not the the headers are *not* duplicated! The actual header says
    "lwIP/1.3.1" where the page contains "lwIP/1.3.2".
    
    Your problem is probably that the generated page struct (in fs_data.c)
    contains HTTP headers but doesn't tell the server it already contains
    those headers and so the server adds these headers again (on sending).
    
    Seem like you're using some kind of messed up version or configuration
    mix of 'makefsdata' vs. httpd...

  • Hi Forrest,
    I didn't realize that you are not using the latest TivaWare version. The latest TivaWare version is 2.1.4.178. Have you had a chance on this latest version?
  • Hello Charles,

    The project we based our design on is the example enet_s2e and is found in the TivaWare_C_Series-2.1.1.71 version. However it is not the 2.1.4.178 and we have never tried to migrate.
    I did check 2.1.4.178 and find that it still uses lwip 1.4.1 so with respect to this problem there is no motivation to change.

    Thanks for pointing out the new version though.

    Forrest Erickson
  • I think "...Seem like you're using some kind of messed up version or configuration

    mix of 'makefsdata' vs. httpd......" is on to something.  

    The batchfile I use to make the "enet_fsdata.h" is as follows

    makefsfile.exe -i fs -o enet_fsdata.h -r
    pause

    The documentation for lwip httpd in the file httpd.c says the following:

     * By default, the server assumes that HTTP headers are already present in
     * each file stored in the file system.  By defining LWIP_HTTPD_DYNAMIC_HEADERS in
     * lwipopts.h, this behavior can be changed such that the server inserts the
     * headers automatically based on the extension of the file being served.  If
     * this mode is used, be careful to ensure that the file system image used
     * does not already contain the header information.
     *
     * File system images without headers can be created using the makefsfile
     * tool with the -h command line option.
     *

    I have modified the batch file to:

    makefsfile.exe -i fs -o enet_fsdata.h -r -h
    pause

    I have rebuilt the file system and the project and loaded into the target and so far it tests with out failure.




  • Hi Forrest,
    Thank you so much for providing this update. Looks like you nail it. Glad that I learn something from this post too. I hope it will benefit people who run into the same issue in the future.

    In the TivaWare user's guide as well in the other post e2e.ti.com/.../799359 I replied you I did mention about using makefsfile -i fs -o enet_fsdata.h -r -h -q. I didn't realize the -h switch has the effect to exclude the HTTP headers from files. I could have asked if you had the switch in your command or not.

  • Charles,

    I have restored my web pages to their full form and retested more thoroughly and the error does not present.

    It was long ago last summer I first modified the HTML and CSS files and learned how to remake the file system. Because I simply cannot remember such a command I made a batch file from some instructions I read, from where I no longer remember. The "-h" switch argument must not have been in that example.

    Sadly by now I have propagated that bad batch file to every other TIVA example with which I have worked both at work and at home on my recreational projects.

    The valuable help question and advise I received from the list serve at lists.nongnu.org/.../msg00020.html

    is what lead me to success.

    Thanks again to you too Charles,

    I am going to mark this as resolved.