Shop OBEX P1 Docs P2 Docs Learn Events
W5100 indirect Patrick1ab driver — Parallax Forums

W5100 indirect Patrick1ab driver

edlikestoboogieedlikestoboogie Posts: 71
edited 2010-06-07 19:54 in Propeller 1
I have been trying to use Patrick1ab's W5100 driver recently that he posted with no luck. If you are listening patrick, how do I properly use your driver to start a listening TCP server?

I am using StartINDIRECT() then InitAddresses() to initialize.

Then I use "repeat while eth.SocketTCPestablished(0) == false" to wait for a connection

and finally use txTCP and rxTCP to send and recieve packets.

Is this how to use your Ver2 of your indirect driver?
Could you please provide us with some sample code on using the driver and any updates if you improved your driver.

I get confused reading your driver code, because some of your methods, like txTCP/rxTCP use writeSPI, which makes me think I am not suppose to use it. In any case I can't even get the W5100 to light the LEDs to my magjack, so the situation is bad, although my router is showing a link to my project.

thanks,
Ed.

Comments

  • Patrick1abPatrick1ab Posts: 136
    edited 2010-06-07 09:40
    Hi Ed!
    edlikestoboogie said...

    I am using StartINDIRECT() then InitAddresses() to initialize.

    Then I use "repeat while eth.SocketTCPestablished(0) == false" to wait for a connection

    and finally use txTCP and rxTCP to send and recieve packets.

    In the latest versions, I changed the RX/TX masks to the RX/TX expmasks.
    Since this differs from the default configuration of the W5100 chip, you will have to set the RX/TX memory size according to the experimental masks.

    Like this:

    startINDIRECT(16,24,8,25,0,27,26,true)           'change the values to the IO ports you are using; "true" adds the support for address auto increment
    InitAddresses(true,@mac_addr,@ip_gateway,@ip_subnet,@ip_addr)
    [b]SetSocketMemory(true,0,eth#_1KB,eth#_8KB)[/b]   'this sets the RX buffer to 1KB and the TX buffer to 8KB
    
    



    If you want to use this driver as a server, you will have to open a socket first and then listen to it:

    SocketOpen(0, eth#_TCPPROTO, 80, 80, @ip_destination)    'this opens a TCP socket 0 with port 80; ip destination is unknown, so set it to 0.0.0.0
    SocketTCPlisten(0)
    
    



    After that, you can call "repeat while eth.SocketTCPestablished(0) == false" to wait for a connection.

    edlikestoboogie said...
    I get confused reading your driver code, because some of your methods, like txTCP/rxTCP use writeSPI, which makes me think I am not suppose to use it.

    I apologize for the confusion I have caused. sad.gif
    You can use every method of the driver (except PUB ResetHardware(_block) is guess, but I commented this out anyway).
    I was simply to lazy to change every "writeSPI" to a "write" or to a "writeINDIRECT".

    edlikestoboogie said...
    In any case I can't even get the W5100 to light the LEDs to my magjack, so the situation is bad, although my router is showing a link to my project.

    That sounds bad to me, since normally this has nothing to do with the driver.
    Have you checked the supply voltage for the W5100 chip? Are the magjack LEDs connected with the right polarity?

    Post Edited (Patrick1ab) : 6/7/2010 10:48:34 AM GMT
  • edlikestoboogieedlikestoboogie Posts: 71
    edited 2010-06-07 19:54
    Hey Patrick1ab,

    I am happy to tell you that I got your driver working on my project. I was able to connect and get some data off the propeller. Oddly enough, the LEDs are still not functioning. Which is really weird since I did not change that part of my PCB layout from my many previous working PCBs with the W5100 configured for SPI. My server code is acting funny so I will have to tighten that up for the next few days, I'll try and do some speed tests to see if this was well worth the migration from SPI.

    Thanks again Patrick for all the hard work and I hope you improve on this driver in the future.
    i'm pretty excited, since I feel like we are the first few people to get this working for the prop.
Sign In or Register to comment.