Shop OBEX P1 Docs P2 Docs Learn Events
Help needed with Mike's spinneret code — Parallax Forums

Help needed with Mike's spinneret code

Don MDon M Posts: 1,652
edited 2013-01-05 17:41 in Accessories
I've been playing with the code from the servebeer pages and also with the later updated drivers recently released. I used some of Mike's html code and modified it for my own testing. Code attached in index.zip file.

I've been using the original http server from the servebeer site and have been testing it locally through my network and also remotely using my Galaxy S3 Android (US Cellular) phone.

Locally using Chrome the page comes up fine every time and I never see any timeouts:

Chrome 1.jpg
PST Chrome 1.PNG


When I use IE (IE8 Windows XP) the page always loads fine but I see a timeout message:

IE 1.jpg
PST IE 1.PNG


For outside of my network I am using a no-ip.org address. It is mdbtest.no-ip.org. The results are the same using this or typing in the remote IP address. No difference.
I get mixed results from remote access. Using the Chrome mobile browser it never completely downloads the whole picture and I get timeouts:

Mobile Chrome 1.jpg
PST Mobile Chrome 1.PNG


Using the stock Android (ver. 4.1) browser it never gets the picture and always has timeouts:

Mobile Android 1.jpg
PST Mobile Android 1.PNG


So what I'd like to understand is what causes the timeouts and what does the data for the timeout on PST mean? Is it the socket number (ID?) and what does the data at the bottom of the request indicate?
Is there something in the code that can be tweaked to allow the picture to load?

I am reserving the next post for Mike's latest code test results using the same html code and browsers, etc.
1024 x 832 - 95K
628 x 659 - 17K
1024 x 934 - 112K
660 x 723 - 19K
1024 x 768 - 249K
472 x 1048 - 23K
1024 x 768 - 230K
443 x 754 - 15K

Comments

  • Don MDon M Posts: 1,652
    edited 2013-01-04 15:28
    Here are the results using the WebServer_W5100 code.

    Locally the page loads fine as above and here are the PST screen shots for Chrome:

    PST Chrome 2a.jpg
    PST Chrome 2b.jpg


    And for IE:

    PST IE 2a.jpg
    PST IE 2b.jpg


    Now for the mobile browser versions the picture never loads. Here is the photo of the browser and PST screen shot for mobile Chrome:

    Mobile Chrome 2.jpg
    PST Mobile Chrome 2a.jpg
    PST Mobile Chrome 2b.jpg


    And for the mobile Android browser:

    Mobile Android 2.jpg
    PST Mobile Android 2a.jpg
    PST Mobile Android 2b.jpg



    Any clues to fix this?

    Thanks for all your help.
    1024 x 880 - 76K
    1024 x 711 - 52K
    1024 x 872 - 82K
    1024 x 315 - 27K
    1024 x 894 - 74K
    1024 x 642 - 48K
    1024 x 768 - 234K
    1024 x 768 - 237K
    1024 x 877 - 72K
    1024 x 881 - 69K
  • Mike GMike G Posts: 2,702
    edited 2013-01-04 15:38
    This comes up from time to time. Increase or decrease the following values found in the CON block of Httpserver.spin. These might be the settled upon values, can't remember.
      DELAY           = $0F
      MAX_TRIES       = $1F 
    
  • Don MDon M Posts: 1,652
    edited 2013-01-04 16:25
    Mike, I tried those values and still the same. I have been looking through the forum for other discussions about these delays but so far I only found one that talks about changing this:
    waitcnt((clkfreq/500) + cnt
    

    but I don't find where that is in the code.

    Here's the post [url] http://forums.parallax.com/showthread.php/138781-Spinneret-Errors-(Can-t-load-page!)[/url]
  • Mike GMike G Posts: 2,702
    edited 2013-01-04 17:05
    Don, the anlyzr.png image is 1/2M(700x400) and the icon is 5k. I can get the image to render on my iPod and Android using the new code and dropping the transmit buffer to SD_BUFFER = $200. See the CON block in WebServer_W5100. I also optimized the MultiSocketService method a while back and did not post the code. The new code is in this post #1.

    I'm not terribly motivated to figure out a way to get a 450K web page image to render on a smart phone using HttpServer.spin. So I attached the same pic as a jpg and 21k. It's still 700x400 though...
    300 x 171 - 7K
  • Don MDon M Posts: 1,652
    edited 2013-01-04 17:43
    Mike, thanks I'll check this stuff out. Regarding the picture file size, it isn't necessary as far as I'm concerned to have had it that large of a file size. It's just that I don't know any better. This is what I'm trying to learn and thanks to your help I'll know why in the future.
  • Mike GMike G Posts: 2,702
    edited 2013-01-04 18:19
    Gotcha... Yeah, you don't want to make the prop and W5100 work harder than needed. I uploaded an image which is a 300x171 7k image. The page will load a lot faster.

    That does not mean the Spinneret cannot download large files, it can it just takes a while.
  • Don MDon M Posts: 1,652
    edited 2013-01-04 19:24
    Ok I am using the smaller file size jpg image and with your original http server code it loads ok with both mobile browsers.

    However, your newer code does not load the picture on the mobile devices even though it shows the rendering countdown on PST. I do notice that the picture loads slower on the local network than with your original code.

    Could it be due to the debugging (rendering coutdown) on PST causing it to slow down?
  • Don MDon M Posts: 1,652
    edited 2013-01-04 19:32
    I commented out the rendering countdown but it made no difference. I also tried changing SD_BUFFER to $200 and it made no difference.

    You can try it yourself by clicking on mdbtest.no-ip.org
  • Mike GMike G Posts: 2,702
    edited 2013-01-04 22:33
    I don't know... it work pretty fast on my setup. You might try reformatting the SD card and re-dropping the files. I'm getting a image format error when trying to render the image from http://mdbtest.no-ip.org/.

    Sometimes the FAT driver behaves unexpectedly when a file is over written. It seems to occur when the file size changes. Otherwise use the old code but again it works fine on my system. One thing to note, the code does not use port 5000. It uses port 80 so you updated the source?
  • Don MDon M Posts: 1,652
    edited 2013-01-05 07:03
    I tried your suggestion and reformatted the card. Still the same result. And remember that this same card worked ok with the original software. As far as the port number is concerned- yes I did change that from the beginning otherwise you'd get nothing.

    Your suggestion of just using the old code instead of the new was kind of surprising to me. Please understand no offense intended but I'd think you'd want the "new" software to work as good or better than the "old" or at least figure out why it doesn't? Are there any debugging tools I can use to monitor the communications to see why this fails?

    So here is what I know using your newest software:

    1. With the sd card plugged into the PC and opening up index.htm with either browser it works fine and the picture renders instantly.
    2. With the sd card in the Spinneret and invoking the local IP address with either browser (192.168.1.25:5000) the picture renders from top down in about 2 seconds.
    3. As above in #2 but through mdbtest.no-ip.org outside of my network I get the image placeholder but no image.

    Using your original software the picture renders twice as fast and also renders remotely.

    So what is different from the original software to the new software in terms of reading the jpg file from the sd card? It appears the problem stems from the speed in which the jpg file is read and sent through.

    Is the 5200 chip / software any faster at this?

    Please understand I'm trying to learn how this stuff works. Right now I have the original software installed.

    Something else I've noticed is that with my 4G cell phone and 4G service it works. When I use a cell phone or tablet with 3G service I don't get index.htm page even though I see the request.

    I wish I knew more about this stuff and why it doesn't work....
  • Don MDon M Posts: 1,652
    edited 2013-01-05 07:06
    Mike G wrote: »
    it works fine on my system.

    Define what you mean by this. Does it work fine from this: mdbtest.no-ip.org or does it work fine from just using your local IP address?
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 07:45
    Don M wrote: »
    Define what you mean by this. Does it work fine from this: mdbtest.no-ip.org or does it work fine from just using your local IP address?
    If I download the code as is. Dropped your web site files to the SD. Run the code. All works as expected.

    Did you by chance add the LED logic to the new code?
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 07:54
    Your suggestion of just using the old code instead of the new was kind of surprising to me. Please understand no offense intended but I'd think you'd want the "new" software to work as good or better than the "old" or at least figure out why it doesn't? Are there any debugging tools I can use to monitor the communications to see why this fails?
    New does not mean better... the new code allows for dynamic XML generation, RESTful service calls, and changes the steps to identify a 404 error. This is due to the potential RESTful call. The new code is simply a different way of dealing with an HTTP request.

    Post the new code exactly as is and I'll take a look.
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 08:30
    I changed the port to 8080, 5000 is in use. Loaded the code and it worked.
    http://spinneret.servebeer.com:8080/

    Does the code function locally?

    Zip up the HTML as is and post that as well.
  • Don MDon M Posts: 1,652
    edited 2013-01-05 08:59
    No the picture is messed up. See attached:

    servebeer.jpg


    The HTML files should be the same as before with the exception of the smaller jpg. I have attached them now.
    1024 x 768 - 78K
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 09:15
    Don, see if this web site works any better.
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 10:13
    Well, I found a problem. Not sure if it's "THE" problem. Right now it looks like a timing issue related to the SPI/W5200 driver not giving the W5200 chip time to update the free Tx size register or, most likely, i am using the register incorrectly for buffer size validation.
  • Don MDon M Posts: 1,652
    edited 2013-01-05 12:07
    Mike- I'm out and about for a bit. I'll check back later when I'm home.
  • Mike GMike G Posts: 2,702
    edited 2013-01-05 16:21
    I created work-around on the original driver thread . See if that work better for ya. Still there's logic that's not jiving with the datasheet or I'm missing something. Basically I just removed free Tx space validation and that did the trick.
  • Don MDon M Posts: 1,652
    edited 2013-01-05 17:41
    Hey hey! That seems to have done the trick. I tried with both versions of the webpage. I now have my original webpage back on the sd card using your latest version of Webserver_W5100.

    Check it out- mdbtest.no-ip.org and let me know how it works.

    Thanks Mike.
Sign In or Register to comment.