Shop OBEX P1 Docs P2 Docs Learn Events
No PST Response on boot — Parallax Forums

No PST Response on boot

T ChapT Chap Posts: 4,217
edited 2012-12-06 06:26 in Accessories
I formatted an SD card, created the index.htm and put it on the card for hello world. I plugged in the card.
  debug := 1    
  'SDCard.Start
  'stringMethods := str.Start
  'Request.Constructor(stringMethods)
  'Response.Constructor(stringMethods, @txdata)

Using BST, I can only get a serial terminal response using the above items commented out. If they are in, there is no response so it is assumed the code is hanging up here.

Any suggestions?
«1

Comments

  • Mike GMike G Posts: 2,702
    edited 2012-12-02 11:20
    I assume you are referring to the tutorial; http://spinneret.servebeer.com:5000/gstart/hello.htm?

    If so, did the previous tutorial step work? The step to setup the configuration.

    How is the SD card formatted? Did you use a computer? Is it FAT, FAT32???
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 11:29
    Mike,

    The card was already formatted new, that didn't work so I reformatted on Win XP, not the quick version. I think FAT32. That didn't work either. I can make the user LED turn on so I know the code is booting, also I can get the serial term to display Mount SD Card - if I comment out the parts above. There is no response from 192.168.1.120:5000. But I do get BLUE and RED activity.


    Obviously it is not getting past the SDcard.start. I pulled the card out and put it back.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 12:16
    What kind of CD card do you have? I use a 2 and 4 gig ScanDisk that I picked up at Wal-Mart.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 12:16
    If the lines are commented out like below, then I can get this far. If I run 192.168.1.120:5000 then the Start of Request shows up as 0, firefox hangs on Mac.
    PUB Initialize | id, size, st
    
      debug := 1    
      'SDCard.Start
      stringMethods := str.Start
      'Request.Constructor(stringMethods)
      'Response.Constructor(stringMethods, @txdata)
    
      pst.Start(115_200)
      pause(200) 
    
      'Mount the SD card
      pst.str(string("Mount SD Card - ")) 
      'SDCard.mount(fileErrorHandle)
      pst.str(string("OK",13))
    



    ?Mount SD Card - OK
    Start RTC: 01/02/2000 00:14:25
    W5100 Driver Started
    
    Status Memory Lock ID    : 0
    HTTP Server Lock ID      : 1
    
    TCP Socket Listener ID   : 0
    TCP Socket Listener ID   : 1
    TCP Socket Listener ID   : 2
    TCP Socket Listener ID   : 3
    
    Started Socket Monitoring Service
    
    Initial Socket States
    
    3-14 2-14 1-14 0-14
    clsd open lstn estb clwt clng udps
    0000-0000-1111-0000-0000-0000-0000
    
    Initial Socket Queue
    FIFO[0] 00000000
    //////////////////////////////////////////////////////////////
    
    ----- Start of Request----------------------------
    
    ID: 0
    Request Count     : 0
    
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 12:17
    4g Radio Shack Sandisk. The disk will open on pc or mac.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 12:36
    You need the following objects constructed (initialized) otherwise - yes - it will lock up
      'Request.Constructor(stringMethods)
      'Response.Constructor(stringMethods, @txdata)
    

    Can you hit http://spinneret.servebeer.com:5000/? Because it is running the exact same code.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 15:25
    Not sure what you mean. If i uncomment those then there is no response at all on serial terminal
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 15:57
    Not sure what you mean. If i uncomment those then there is no response at all on serial terminal
    Request and Response are required in HttpServer. Have you made any changes to the code?
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 16:36
    No changes except adding my mac number.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 16:51
    Archive the current code with the propeller tool and attach. I'll take a look.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 17:00
    Thanks Mike but it is the same code off your site and I also tried it off the code repository.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 17:31
    TChap, this code has been running for the better part of 2 years and is on many Spinnerets.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 17:36
    Must be a defective board then I will get another one this week.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 17:57
    Try loading the source with the Propeller Tool.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 18:32
    BTW, I create a SPI driver for the Spinneret ~20Mhz up and ~10Mhz down. This allows the Spinneret to interface with code I designed for the WizNet 5200.

    T Chap, Please give it a shot and let me know if it works. You'd be the first... Unless D.P. finds this thread.
  • Mike GMike G Posts: 2,702
    edited 2012-12-02 18:50
    This archive uses the SD card and the same S35390A_SD-MMC_FATEngine driver. The file on the SD card must be named index.htm. The top level object is TcpSocketServerDemo.spin.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-02 19:08
    Mike, i will try all the ideas when i am back at the shop tomorrow. Thanks.
  • T ChapT Chap Posts: 4,217
    edited 2012-12-03 07:41
    I have changed from the Mac to the PC, now using Prop Tool instead of BST. I downloaded fresh httpserve.zip and place the extracted content into the Prop Tool folder. When running httpserv.spin, there is an error on the String Methods below : mult.
    djnz    j, $-1                  ' decr j and; jump to current min
    

    Illegal hex number. After removing the -, so that the number is just $1, the program compiles and loads. The PST shows what it should that did not work on BST. I looked back on the Mac and the code also has the $-1, but no errors are reported in Spin.

    Just be check again, I re-downloaded the same zip, extracted, replaced all older copies in the folder, and got the same exact error. Fix the error and it compiles.

    Without making ANY changes to the code, I can type in Firefox and IE and each browser displays the following in the pane:


    {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fmodern\fcharset0 Courier;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww10500\viewh9600\viewkind0 \deftab720 \pard\pardeftab720\ql\qnatural \f0\fs24 \cf0 \ \ \ \ \ Hello World!\ \ \ }

    I thought I had copied and pasted the exact notes from the setup document, but it could have been weirded out using a Mac and text editor. This is a minor issue to solve on my end.

    Next, I tried to change the MAC address to my board numbers. Making any change to the MAC addr causes the browser to just spin, never loads. Using the default MAC address the in code of byte $00, $08, $DC, $16, $EF, $22 and the browser will load the hello world page. Why can I not change to my own MAC address written on the bottom of the board?
  • Mike GMike G Posts: 2,702
    edited 2012-12-03 09:24
    Post your code
  • T ChapT Chap Posts: 4,217
    edited 2012-12-03 09:39
    Mike, the code is straight off your link. Only changing MAC address, nothing else. Is there a point to uploading the httpserv.spin when it is direct off your link?
  • Mike GMike G Posts: 2,702
    edited 2012-12-03 13:27
    Well, then I can run the code, exactly as posted, on my Spinneret and verify. Otherwise, stand on one foot hop three times while touching your nose.
  • Mike GMike G Posts: 2,702
    edited 2012-12-04 07:34
    I downloaded the source code from the Google code repository and it functions as expected. I hope you are not grabbing the code from here - http://www.agaverobotics.com/spinneret/source/ as this site does not contain the latest code! The latest code can be found http://code.google.com/p/spinneret-web-server/source/browse/#svn%2Ftrunk%2FMultiSocketServer_MikeG

    Once again, if you post the source code loaded in the Spinneret, I'll verify that you have the latest files. I can't understand why you are against such a simple request. Especially when I'm trying to help you.

    How is the Spinneret connected to your network? What are your network parameters; Subnet, Gateway...?
  • T ChapT Chap Posts: 4,217
    edited 2012-12-04 09:27
    http://spinneret.servebeer.com:5000/

    This is where I got the original files. I have just replaced all of the files from with the files from here as you requested:

    http://code.google.com/p/spinneret-web-server/source/browse/#svn%2Ftrunk%2FMultiSocketServer_MikeG

    I just uploaded the same httpserver.spin that I just downloaded off your link, they should be identical to the link.

    One thing I have noticed, that with PropTool V1.02 the Strings Method produces an error as I mentioned before. I got the newer PropTool 1.3.2 and it does compile without the illegal hex value.

    I replaced all the files linked on that url above that you said is the latest. Still the same problem. If I run the code AS IS, direct off the site with NO changes, I can type 192.168.1.120:5000 and get HELLO WORLD!. BUT, if I change the MAC number, to my device number, or to ANY other number, the 192.168.1.120:5000 just spins and times out with "not found".

    So, why does this require that the MAC number must be the number that is already in the DAT section as downloaded, when I understood from your tutorial on servebeer.com that I needed to change these settings?
  • T ChapT Chap Posts: 4,217
    edited 2012-12-04 09:40
    Here are the settings I am changing the DAT values to:


    DAT
    mac byte $00, $08, $DC, $16, $F3, $1B
    subnet byte 255, 255 ,255, 0
    gateway byte 192, 168, 1, 254
    ip byte 192, 168, 1, 120
    port word 5000
    remoteIp byte 65, 98, 8, 151 {65.98.8.151}
    remotePort word 80
    uport word 5050


    When I open ipconfig:

    Wireless:
    subnet = 255.255.255.0
    default gateway = 192.168.1.254
  • Mike GMike G Posts: 2,702
    edited 2012-12-04 10:12
    If I understand correctly, the source files "as is" work fine. When the network parameters are updated the HTTP request stops working as expected.

    The gateway address in the "as is" source is 192.168.1.1. Is there more than one router involved in this network? Is the Spinneret connected to a router or a PC?
  • T ChapT Chap Posts: 4,217
    edited 2012-12-04 10:54
    I went to my router and changed the default gateway from 254 to 1, restarted everything and now I can finally change the MAC address to my units number.

    The spinnerete is connected via ethernet cable to the main router.

    It do not understand why using a gateway of 192.168.1.254 would allow your default MAC address to return Hello World, but I couldn't enter my own devices MAC. But for some strange reason, using 192.168.1.1 as the gateway, I can use my own MAC number. Weird stuff, but whatever it takes.

    Thanks for the help. I will now try to turn on and off the built in user LED from LAN. I have the index and LED files on the SD card and can see the helloworld/led options. But clicking LED ON, nothing happens. It looks like the same httpserver.htm found under hsled has the LED code.
  • Mike GMike G Posts: 2,702
    edited 2012-12-04 14:19
    I don't think it has anything to do with gateway, MAC, or IP. It's probably switch related. Initially IP 192.168.1.120 was associated with MAC 00:08: DC:16:EF:23. The MAC address changed to 00:08: DC:16:F3:1B but the switch did not register the update. Requests for 192.168.1.120 were directed to 00:08: DC:16:EF:23 which no loner existed. Resetting the router probably cleared the routing table. Just a speculation...
  • T ChapT Chap Posts: 4,217
    edited 2012-12-05 08:20
    Thanks again Mike. I am now testing the LED code, as my goal is to GET or POST to the device, update parameters, control stuff etc.
    On your Getting Started tutorial http://spinneret.servebeer.com:5000/gstart/get.htm,  I put that and the index.htm on the SD drive.  I also installed the HSLED.spin off the google downloads link you provided.  I assumed this was required to run the LED, since the other version httpserver does not have any code for LED.  
    
    The Hello World Works.  When I click the LED page button, I see RESTful, LED ON,  LED OFF,  LED: State.   If I click on LEDOn, nothing happens.  If I click it twice, the wheel just spins and it is locked up, the board requires reboot to work again with Hello World.  Same thing happens on LED OFF, press once, nothing,  press twice,  locked.  
    
    I have posted both the codes from the SD and Spin.  I have all the latest associated files off the google site you linked.  
    
    Can you give any advice on how to get this to work so I can start dissecting it and change to my own GET requirements?  
    
    Thanks
    
    [code]
    <html>
    <head>
    <title>Hello World</title>
    </head>
    <body>
    <div style="width:600px;margin:auto;">
      <h1 style="text-align:center;color:blue;">Hello World!</h1>
      <div style="text-align:center;"><a href="index.htm">Hello World</a> | <a href="led.htm">LED</a></div>
    </div>
    </body>
    </html>
    
    <html>
    <head>
    <title>GETing AJAX</title>
    <script language="javascript" type="application/javascript">
    //Gets the browser specific XmlHttpRequest Object
     function getXmlHttpRequestObject() {
    	 if (window.XMLHttpRequest) {
    		 return new XMLHttpRequest();
    	 } else if (window.ActiveXObject) {
    		 return new ActiveXObject("Microsoft.XMLHTTP");
    	 } else {
    		 alert("Your Browser does not support AJAX!\nIt's about time to upgrade don't you think?");
    	 }
     }
    
     //XmlHttpRequest object
     var req = getXmlHttpRequestObject();
     var htmlTarget;
    
    
     function getRequest(resource, elementId) {
     	
    	// handle the case where a querystring is not detected
    	var char = "&";
     	if(resource.indexOf("?", 0) == -1) {
    		char = "?";
    	}
    		
    	 if (req.readyState == 4 || req.readyState == 0) {
    		 req.open("GET", resource + char + 'ms=' + new Date().getTime(), true);
    		 req.onreadystatechange = handleResponse;
    		 htmlTarget = elementId;
    		 req.send(null);
    		 return false;
    	 }
     }
    
     function handleResponse() {
    	 if (req.readyState == 4) {
    
    		 var str = req.responseText;
    		 //alert(str);
    
    		 var placeholder = document.getElementById(htmlTarget);
    		 placeholder.innerHTML = str;
    	 }
     }
    </script>
    </head>
    <body style="background-color:beige;">
    <div style="width:600px;margin:auto;background-color:white;padding:10px;">
      <h1 style="text-align:center;color:blue;">LED</h1>
      <div style="text-align:center;"><a href="index.htm">Hello World</a> | <a href="led.htm">LED</a></div>
      <h2>RESTful</h2>
      <p>
      	<a href="led.htm" onClick="return getRequest('led/23/on', 'placeholder');">LED On</a> :: 
        <a href="led.htm" onClick="return getRequest('led/23/off', 'placeholder');">LED Off</a>
      </p>
      <p>LED: <span id="placeholder">State</span></p>
    </div>
    </body>
    </html>
    
  • Mike GMike G Posts: 2,702
    edited 2012-12-05 14:27
    The LED HTML in the GETing to the Server example uses a query string to pass data and should have the following format.
    [html]
    <html>
    <head>
    <title>GETing to the Server</title>
    </head>
    <body>
    <div style="width:600px;margin:auto;">
    <h1 style="text-align:center;color:blue;">LED</h1>
    <div style="text-align:center;"><a href="index.htm">Hello World</a> | <a href="led.htm">LED</a></div>
    <p><a href="led.htm?led=on">LED On</a> :: <a href="led.htm?led=off">LED Off</a></p>
    <p>LED: <span id="placeholder"></span></p>
    </div>
    </body>
    </html>
    [/html]

    The HTML code in post #29 is for use in RESTful HTTP requests. This is where data is embedded in the URL.
    http://spinneret.servebeer.com:5000/services/restled.htm
  • T ChapT Chap Posts: 4,217
    edited 2012-12-06 06:26
    Thanks for the info Mike, LED is happy now.
Sign In or Register to comment.