Jump to content
43oh

CC3200 Webserver question (CLOSED)


Recommended Posts

Hi everyone,

 

I have been playing with my Launchpad for a couple of weeks now, and been playing with a fairly basic web server over wifi on port 9080. The port on my router is open, and I have external public access to my server.

 

The problem is this, if I ask somebody to open the page, they say 'it doesn't work, it is just blank'. Then I tell them to click refresh, and they will see the page as intended. 

 

While I have been working on this project, I have had a tab open in IE11, and a tab open in Chrome 41. I have noticed the same symptom, first time nothing, click refresh, voila....... But if those tabs are left inactive for any amount of time, even clicking refresh sometimes the sands of time just whirls round for long periods, eventually timing out in many cases, this page cannot be displayed. But then, click refresh again, and we are back in business, and then subsequent refreshes will usually update the page.

 

I have used port forwarding on the router, not port triggering. I have tried accessing the internal private ip address of the CC3200, the symptoms are still the same, first time, nothing, click refresh, then is ok. This is really not ideal........ REAL web servers don't need a wakeup kick, why does this thing?? Any ideas please?

 

Energia version 14 is currently what I am using.

 

If anybody wants to try it to see what I am talking about this is the link

 

REMOVED DUE TO CLOSING THIS THREAD

 

Thanks,

 

Graham

 

Edit: Clearly I cannot leave it connected and on indefinitely, but it will be on most of the time for the next day or so unless I am updating it.

Link to post
Share on other sites

 

Not sure. Could it be your favicon?

http://www.webpagetest.org/result/150409_G4_NYF/1/details/cached/

 

http://ghlawrence.my...org:9080/favicon.ico - 3.297 s - 3297 ms 383 ms 1 ms 0.0 KB -2 81.104.238.7

 

 

bluehash, many thanks!

 

I have implemented favicon and subsequently caching of favicon and the jpeg image. Implemented keep-alive. The result is quite acceptable I think, could you try it again for me please?

 

Regards,

 

Graham

 

PS, The statistics and analyses are great, but I would also like to know, on first attempt, does the page display or fail?

Link to post
Share on other sites

I tried it yesterday evening (UK time) and it mostly seemed OK for me. Initial load was OK. Some refreshes missed the image at the top of the page. Some timed out. I can't check from work - maybe the port is blocked at this end.

 

I'll take a complete guess that you're not handling concurrent requests well - i.e. the separate requests for the page content, image and favicon are tripping each other up.

 

Just got my own CC3200 last night. Not done much with it apart from the demo and project 0. I doubt I'll have the time for a while either.

Link to post
Share on other sites

I'll take a complete guess that you're not handling concurrent requests well - i.e. the separate requests for the page content, image and favicon are tripping each other up.

 

Is that possible using the basic webserver example? 

 

I am serving the image/favicon/html page from an SPI flash, using a routine I wrote myself. The routine I accept is 'blocking' but the times taken are not huge.

 

/ html = 22ms

/ insert.jpg = 124ms

/ favicon.ico = 5ms

 

Can somebody point me in the right direction how I can write a non-blocking routine? The code for my 'servespi' routine is here. Go gently with me, I am a novice  :blush: .

uint32_t serveSPI(uint32_t startAdd, uint32_t endAdd, WiFiClient myClient)
{
  uint32_t pageread =0;
  uint8_t databyte[256];
  uint32_t address = startAdd & ~255;
  uint32_t mytime;
  int myoffset, bufptr;
  while (address < endAdd) {
    digitalWrite(LED, HIGH);
    mytime=micros();
    if (beginRead(address)) {
      for(int i = 0; i<256 ; i++)
        databyte[i]=SPI.transfer(0);
      endRead();
      pageread=pageread+(uint32_t)(micros()-mytime);
      digitalWrite(LED, LOW);
      myoffset=0;
      bufptr=0;
      uint8_t chunkbuf[256];
      while(myoffset<256)
      {
        if(((address+myoffset)>=startAdd) && ((address+myoffset)<=endAdd))
        {
          chunkbuf[bufptr]=databyte[myoffset];
          bufptr++;
        }
        myoffset++;
      }
      myClient.write(chunkbuf, bufptr);
      address += 256UL;
    }
  }
  return((pageread));
}

If this would be more appropriately posted in a different thread, accept my apologies, and point to which thread would be more suitable. Thanks for the help I received so far.

 

Regards,

 

Graham

Link to post
Share on other sites

I've no idea if there's anything wrong with the code (and it look like Energia so not something I use).

 

The reason I thought about that is that 2 calls seem to perform well and the third gives a problem. I'm guessing that the third request comes whilst the first 2 are being processed. Maybe it's blocked. Maybe it accidentally overwrites shared memory. Not basing this on anything other than a gut feeling as to something worth checking.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...