Sections
You are here: Home Forum Development Discussion Web server issues

Web server issues

Up to Development Discussion

Web server issues

Posted by Blake Hannaford at August 19. 2008

I'm having trouble getting the web server to work.   Using firmware 1.5.1, I'm not getting response to pings.    Web server does not respond ("Unable to connect \\ Firefox can't establish a connection to the server at xxx.xxx.205.25"). 


Relevant sections of code are:

run()
{
...

// Starts the network up.  Will not return until a network is found...
  Network_SetActive( true );

// Supposedly only need to do these once (they are flashed)
//Network_SetDhcpEnabled(0);        // Static IP
//Network_SetAddress(128,95,205,25) ;  

           // start web server 
if( WebServer_SetActive(1) != CONTROLLER_OK)  {
      error(0,0,0,1);
      }

        // register page handler
 if( WebServer_Route( "/page", BHHandler ) != CONTROLLER_OK)  {
      error(0,0,1,0);
    }
 
  TaskCreate(   BlinkTask,"blink", 400, NULL, 1);

}


Any ideas??

Re: Web server issues

Posted by Liam Staskawicz at August 19. 2008
If you're not getting response to pings, the problem is probably not webserver specific. What if you try setting the address before you set the network to active? Or can you try using dhcp? I've heard a couple reports lately that make me think something might be funny with manually applied addresses...

Re: Web server issues

Posted by Blake Hannaford at August 19. 2008

Well,  if I use dhcp, I don't have access to dhcp server so I can't figure out what addr the make board has.


Re: Web server issues

Posted by Liam Staskawicz at August 20. 2008
Can you plug it in via USB and see what its address is once it gets one from DHCP?

Re: Web server issues

Posted by Blake Hannaford at August 20. 2008

I'm using linux and was not able to get mchelper working so I'm doing everything with the sam7 tools.  The best output I have from the board is the 4 led's.  I considered writing code to display the IP address as 12 4-bit BCD values but I thought the forum would be quicker!  


Do you have a short heavy program (i.e. make.c file) which works for you to serve a minimal web page?

Re: Web server issues

Posted by Hugobox at August 20. 2008

Also the listenport sometimes gets scrambled to -452314151 (dont remember the number exactly, but negative an long) instead of 80, try resetting the listenport, it might help.

Re: Web server issues

Posted by Liam Staskawicz at August 20. 2008
This is the Test Handler used in the webserver library: http://www.makingthings.com/ref/firmware/html/webserver_8c-source.html#l00621 About as simple as it gets, I think. A slightly fancier version can be seen at http://dev.makingthings.com/browser/mcbuilder/trunk/resources/examples/Communication/LedWebServer/LedWebServer.c

Re: Web server issues

Posted by Hugobox at August 20. 2008

Ok, I tried to reproduce the listenport bug, and with a  YAGARTO compiled Heavy, I can't reset the listenport to 80 with OSC, so now the listenport is stuck to  exactly: -442503148.

With the Crossworks compiled Heavy.bin, the default listenport is: -442503144, but at least, I can set it to 80 through OSC.

Re: Web server issues

Posted by Liam Staskawicz at August 20. 2008
Sounds like it must be uninitialized. Is this after setting the webserver to active?

Re: Web server issues

Posted by Hugobox at August 20. 2008

I can't set the webserver to active via OSC in a Yagarto compiled Heavy, nor change the listenport value.

Re: Web server issues

Posted by Liam Staskawicz at August 20. 2008
Try increasing the heap available to your application (config.h), then the webserver should be able to run.

Re: Web server issues

Posted by Hugobox at August 20. 2008
heap increased to 30000: still cannot set webserver to ON via OSC UDP.

even putting the line WebServer_SetActive( true ); in Run doesn't activate the webserver.

Re: Web server issues

Posted by Blake Hannaford at August 20. 2008

Thanks for all this info and testing!


Regarding my request, I know about the handler in the firmware distro (1.5.1), but what I would like is a complete known-good make.c (perhaps using that handler) which I could build on my system. 


Another nice example program would be one which only activates the network module to support ping testing.

Also, I look forward to resolution of the above listenport,  WebServer_SetActive( true ) issue.


Re: Web server issues

Posted by Blake Hannaford at August 20. 2008

Update:   Currently I'm getting reliable ping connection to the board, but still no response to port 80.

Re: Web server issues

Posted by Blake Hannaford at August 20. 2008

Oops!   I'm not getting pings at all (I forgot that I turned my printer back on at the same addr!).

Re: Web server issues

Posted by Blake Hannaford at August 21. 2008

Here are a few more steps I have taken since the above brain fart which have not resolved the problem:


1)  included all appropriate .h files to resolve compiler warnings
2)  Increased CONTROLLER_HEAPSIZE to 81000
3)  Increased NETWORK_MEM_POOL    to     8000  in config.h
4)  IncreasedNETWORK_TCP_LISTEN_CONNS  to 4 in config.h

If anyone out there has a working heavy/make.c which implements a basic web server I'd appreciate a copy.
THX


Re: Web server issues

Posted by Hugobox at August 21. 2008

Hi Blake,

For me, the one that works is the precompiled heavy.bin that is downloadable on makingthings.com Start from there. Then if Pinging works, try sending network OSC commands to check if webserver is running, what's the listenport, then try the browser. Check the Make IP address to the same subnet as your PC. Good luck.

I've noticed that all the info about the tasks and their priority is no longer displayed on the webserver? That was kinda useful.

Re: Web server issues

Posted by Liam Staskawicz at August 21. 2008
You can still get the task information by sending the OSC message '/system/task-report' - I moved that out of the webserver to keep the example there as simple as possible. Blake - I'll have a look into your webserver issue tomorrow and hopefully have some answers for you.

Re: Web server issues

Posted by Blake Hannaford at August 21. 2008

Thanks all.   I tried downloading heavy-1.5.1.bin  and flashed it, but still no ping.  Is there a source file for heavy-1.5.1.bin?    (I am on linux and cannot get MChelper to see the make controller ... apparently this problem is being worked but what can I do in the meantime?). 

Re: Web server issues

Posted by Liam Staskawicz at August 22. 2008
Hi Blake - if you're not getting pings out of the default build, I would make sure you can get that working first. What's your network setup look like? Any idea what address the board might be getting?

Re: Web server issues

Posted by Blake Hannaford at August 22. 2008

I've taken the fresh make.c file from heavy and added the following:


// Starts the network up.  Will not return until a network is found...

if( Network_SetActive(1) != CONTROLLER_OK)  {
      error(0,0,1,1);
      }

// Supposedly only need to do these once (they are flashed)
//Network_SetDhcpEnabled(0);        // Static IP
Network_SetAddress(128,95,205,25) ;  

     // start web server 
if( WebServer_SetActive(1) != CONTROLLER_OK)  {
      error(0,0,0,1);
      }
        // register page handler
 if( WebServer_Route( "/page", BHHandler ) != CONTROLLER_OK)  {
      error(0,0,1,0);
   }


If I comment those out the orange light on the ethernet port does not go on (certainly a bad sign for ping).  If I put them back the light comes on, but still no ping response.    Why shouldn't Network_SetAddress work ??

Re: Web server issues

Posted by Liam Staskawicz at August 22. 2008
Because the default heavy build doesn't ping for you, I think the issue is not with the firmware, but perhaps with the network setup. What's the address info for your desktop/laptop, your router, etc.? How are you connecting to the network? If you want to set a manual address, you'll also need to set the gateway to something sensible for your network.

Re: Web server issues

Posted by John (EBo) David at August 22. 2008
A quick question... are you plugging the controller directly into the computer or are you running it through a hub? I've never gotten it to work pluged directly into my laptop, but it works fine through a hub. Sorry if you've already tried this... EBo --

Re: Web server issues

Posted by Blake Hannaford at August 22. 2008

Thanks all,

I'm on a large subnet in a university with a little hub in my office.  The static IP I have chosen for the make board is the same one as  the printer in my office (i.e. no conflict when printer is off) which is also plugged into my hub.   When the printer is turned on, I can ping the printer from my computer (thus my development laptop is talking to the right network).    When I'm testing the Make controller it's plugged intot he same hub and the lights on hub and Make board indicate a good connection.  

I'm not setting the gateway yet but that shouldn't be needed for the same subnet I think.  ... I'll try it just to be sure...


Re: Web server issues

Posted by Blake Hannaford at August 22. 2008

Quick update.  I'm now setting the gateway (Network_SetGateway) to correct value. Still no ping response.

Re: Web server issues

Posted by Liam Staskawicz at August 22. 2008
Sharing IP addresses (even if things are off) seems like it's just inviting trouble - I would keep those separate just to be sane. Have you already exhausted the DHCP option? I've had that work nicely in crazily complex networking scenarios (universities, conference centers, etc.)

Re: Web server issues

Posted by Blake Hannaford at August 22. 2008

The advantage of using the printer's static IP is that I know it's not used elsewhere.  Asking for another address is a pain in large organizations.     The problem with DHCP is that I will not know which IP address the board gets and then cannot ping it or connect to its web server.

Re: Web server issues

Posted by Blake Hannaford at August 22. 2008

Recall that in linux I cannot use MChelper to connect to the board and interrogate the IP address.


Re: Web server issues

Posted by Liam Staskawicz at August 22. 2008
As a test, you could try using DHCP and then have the board send out some broadcast packets you could listen for.

Re: Web server issues

Posted by eapolo at August 22. 2008
From what I experienced so far, as long as none of the ethernet led is on -- when you reset and power cycle  nor is it on after you load the firmware (assuming the firmware activates the networking ) you will never get the ethernet tcp/ip to work.  So those are the indicators I used for self checking.  I have been having these difficulties with the ethernet led shutting off after a system power down at  night.   I was expecting the network to be up and ready at power up (after being off at night) but it is not. It seems like the eeprom did not hold the network settings, so I have to reload the firmware again in the morning.  Momentary power off seems okay though (no more than 2 minutes), the network comes back up. 
  Btw, yeah I wish the linux support is more robust for allowing us to load MC via usb.  I can not get the usb to work even with sam7utils -- but thats another post for me.
Powered by Ploneboard
Document Actions