Web server issues
Up to Development Discussion
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??
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.
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?
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.
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.
I can't set the webserver to active via OSC in a Yagarto compiled Heavy, nor change the listenport value.
even putting the line WebServer_SetActive( true ); in Run doesn't activate the webserver.
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.
Update: Currently I'm getting reliable ping connection to the board, but still no response to port 80.
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
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.
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?).
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 ??
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...
Quick update. I'm now setting the gateway (Network_SetGateway) to correct value. Still no ping response.
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.
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.

