Shop OBEX P1 Docs P2 Docs Learn Events
New Drivers for the Spinneret — Parallax Forums

New Drivers for the Spinneret

Mike GMike G Posts: 2,702
edited 2013-02-24 10:33 in Accessories
In the very near future, Parallax will release the WizNet 5200 for the QuickStart. I have spent a fair amount of time (since April 2012) building a driver and object code for the W5200. All the time feeling a little guilty, neglecting the Spinneret and Spinneret users. I received a few emails and PMs only adding to my onus.

Last weekend I build a high speed SPI driver for the W5100 (Spinneret). The driver uses the same interface as the WizNet 5200 for the QuickStart. All W5200 code will work on a Spinneret provided there are enough sockets to support the intended application.

Attached is a simple web server using the new driver and object code.

The most up to date code can be found on Google code.

Comments

  • twctwc Posts: 107
    edited 2012-12-10 03:36
    Hey Mike:

    FYI I tweaked a number of the W5200 programs I've been using to run on my Spinnerette, real easy...

    - Change occurrences of OBJ "W5200" to "W5100"
    - Change Prop pin numbers used to Spinnerette pin assignment (i.e.replace wiz.QS_Init with wiz.Start)
    - Change socket numbers used to fit 0...3 instead of 0..7
    - Change MAC address to Spinnerette MAC address

    There were a few glitches I'll elaborate in a following post, but overall went quite well. I ran a modified version of the W5200 TCSDDD program on Spinnerette overnight 1000+ passes with flying colors! Now Spinnerette users can take advantage of your great software.
  • Don MDon M Posts: 1,647
    edited 2012-12-31 15:58
    I loaded this latest version to my Spinneret. The webpage loads and I click on LED it changes the page to the LED off / on but when I click on LED on I don't see the LED trun on.

    I see the request on PST- GET /led.htm?led=on HTTP/1.1 and when I click on LED off I see the response with led=off.

    Is there something else I missed that needs to be setup for the LED?

    I have attached the spin archive that I'm using.

    My IP is [url]50.103.26.40:5000[/url] if you want to test it.

    Thanks.
    Don
  • Mike GMike G Posts: 2,702
    edited 2012-12-31 16:20
    Don, you have to write the code to execute the LED logic. Use the HttpHeader.Get method to read the led=on/off name/value pair before sending the response.

    Do you need an example?
  • Don MDon M Posts: 1,647
    edited 2012-12-31 16:46
    Yes I could use an example. I realized that there isn't any methods in this code to light the LED. I went to your servebeer website and am looking through that code. I downloaded that code to the spinneret and added the PRI Led(id) method and have gotten the LED to light.

    What do I need to do to make it work with your new code?

    What are the advantages of your new code?

    Thanks.
    Don
  • Mike GMike G Posts: 2,702
    edited 2013-01-01 18:45
    Modifications to control the LED attached to PIN 23. I would have done this sooner but was down with the flu.
    PRI MultiSocketService | bytesToRead, i, fn
      bytesToRead := i := 0
      repeat
        bytesToRead~ 
        CloseWait
        
        'Cycle through the sockets one at a time
        'looking for a connections
        repeat until sock[i].Connected
          i := ++i // SOCKETS
    
        'Repeat until we have data in the buffer
        repeat until bytesToRead := sock[i].Available
    
        'PrintAllStatuses
        
        'Check for a timeout error
        if(bytesToRead < 0)
          pst.str(string(CR, "Timeout",CR))
          PrintStatus(i)
          PrintAllStatuses 
          next
          
        'Move the Rx buffer into HUB memory
        sock[i].Receive(@buff, bytesToRead)
    
        'Display the request header
        pst.str(@buff)
    
        'Tokenize and index the header
        req.TokenizeHeader(@buff, bytesToRead)
     
        fn := req.GetFileName
        ifnot(FileExists(fn))
          sock[i].Send(@_404, strsize(@_404))
          sock[i].Disconnect
          sock[i].SetSocketIR($FF)
          i := ++i // SOCKETS
          next
        else
          'Execute file logic
          ExFileLogic(fn)
          
          BuildAndSendHeader(i)
          RenderFile(i)
       
        'Close the socket and reset the
        'interupt register
        sock[i].Disconnect
        sock[i].SetSocketIR($FF)
    
        i := ++i // SOCKETS
    
    PRI ExFileLogic(fn)
      'Filter by led.htm
      if(strcomp(fn, string("led.htm")))
        led
        return
    
    PRI Led
      'Get the value of the led querystring
      if(strcomp(req.Get(string("led")), string("on")))
        PinState(23, 1)  
      if(strcomp(req.Get(string("led")), string("off")))
        PinState(23, 0)    
    
    PRI PinState(pin, state)
    'Set a pin high or low
      dira[pin]~~
      outa[pin] := state
      return
    

    The code is very basic. It looks at the file name being requested. If the file is led.htm then the code looks for the querystring parameter ?led=on/off. If the led=on PIN 23 is set to high. If led=off the pin is set low.
    What are the advantages of your new code?
    All the W5200 libraries are comparable with the new Spinneret SPI driver with a little configuration.
  • Don MDon M Posts: 1,647
    edited 2013-01-03 19:04
    Mike thanks so much for all your work and help in this. I missed your reply until today. I got it working but will have more questions in the coming days.
  • TumblerTumbler Posts: 323
    edited 2013-02-22 21:32
    Mike, i'm having problems with the new driver.
    I have some htm/css files on a sd card.
    But the css file is not loading (debug window shows a timeout)
    when i load the first spinneret driver, the page is loading perfect.

    And using the 8.3 standard for the filenames.
  • Mike GMike G Posts: 2,702
    edited 2013-02-23 06:29
    Did you get the latest files from Google code?

    Zip and attach your HTML source. If you have modified the web server in anyway, attach the source as well.
  • MoskogMoskog Posts: 554
    edited 2013-02-23 07:31
    Tumbler wrote: »

    And using the 8.3 standard for the filenames.

    oops.. 8.3 limitations...? Didn't notice that, but that solved another little mystery here!

    Thanks, Tumbler!
  • TumblerTumbler Posts: 323
    edited 2013-02-23 07:48
    I have the latest files Mike.
    Attached the files on the SD card.

    PS These files work with your first spinneret firmware
  • Mike GMike G Posts: 2,702
    edited 2013-02-23 08:04
    I'm running WebServer_W5100_RTC.spin right now without issue.

    1) Attach the HTML code.
    2) How many resources are loaded per request (I need to HTML)?
    3) Which library are you using?
    PS These files work with your first spinneret firmware
    What firmware are you referring to?
  • TumblerTumbler Posts: 323
    edited 2013-02-23 09:05
    Oops sorry, forgot the files :frown:
    SD Card.zip

    I'm using WebServer_W5100.spin
    How many resources are loaded per request
    Don't know Mike, i can't debug now (not at home)
  • Mike GMike G Posts: 2,702
    edited 2013-02-24 07:20
    Tumbler, WebServer_W5100.spin does not handle sub directories everything must be in the root. The index page creates 4 connections and the css opens an additional 2. That's 6 possible concurrent connections while WebServer_W5100.spin has 3 sockets available. One of the sockets is used for DHCP.

    I updated the web server to handle sub directories but doing so messed up some other things I was working on.

    It looks like you want a web server so the classic HttpServer will work fine.
  • TumblerTumbler Posts: 323
    edited 2013-02-24 10:33
    Ah ok, each src link to a css or js file needs a socket. Didn't know that.
    Thx for the info.
Sign In or Register to comment.