Shop OBEX P1 Docs P2 Docs Learn Events
WizNet W5100 - Page 2 — Parallax Forums

WizNet W5100

2»

Comments

  • Patrick1abPatrick1ab Posts: 136
    edited 2009-11-11 13:31
    Damn! I can't make it work and I don't understand why... devil.gif

    Neither the SimpleTCPServer nor my own server program.


    I'm doing all the initializations and they are fine when I reread them, but I am not able to establish a connection. Even the RX/TX status leds are flashing when I send requests or ping, so the network cable is fine, too.
    As you can see in the screenshot (last line) I'm repeatedly reading the value of the "Socket n Status Register" and it always says "14" which means "SOCK_LISTEN" according to the W5100 datasheet on page 29.
    It just won't turn to "17"...



    Anyone who has an idea how to solve this, please let me know
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-11-11 17:41
    I'm jumping in very late into the thread, it sounds like you are going for speed, so I thought I would ask why not use a more parallel connection to the W5100 instead of the SPI?

    I am excited to someday have my work life chill out and then I can return to working with the W5100. I have a couple new modules I got a couple months ago, but I haven't had time to start writing and rewriting code.

    Thanks too for the tip on the counters for making code clock in/out faster.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • Paul Sr.Paul Sr. Posts: 435
    edited 2009-11-11 17:49
    I was wondering when you would jump in on this, Tim. Started to get concerned that you hadn't been around in a while! I haven't touched mine since I verified your code was working....way back then!! I am also glad to see this progressing - I would like to get some use out of the 5100 I have, but no time to focus on it.

    Good work guys!
  • DynamoBenDynamoBen Posts: 366
    edited 2009-11-11 17:51
    Timothy D. Swieter said...
    I'm jumping in very late into the thread, it sounds like you are going for speed, so I thought I would ask why not use a more parallel connection to the W5100 instead of the SPI?

    Mostly pin count, I would rather not burn up pins for parallel. Further by sticking with SPI the hardware interface between the Microchip ENC and the WizNet are interchangeable (both are SPI). Finally we are discovering that the speed limit isn't the prop its the read/write speed on the WizNet which would apply to all the connection types (parallel or SPI). The WizNet seems to have a limit at about 10Mbit/sec whereas the prop can go up to 20Mbit/sec.
  • lonesocklonesock Posts: 917
    edited 2009-11-11 18:03
    Note that you can do SPI writing at > 20MHz if you use the video hardware. But I can't think of any way to do SPI reading at > 20MHz (in a single cog). When I was looking for an ethernet chip I ran into the same basic problem: I want to communicate via the SPI bus to use fewer pins...the 5100 looked like better specs, but with the lower SPI clock speed, it had a lower throughput. Also, Microchip just released the big brothers to the ENC28J60, the ENC424J600 and ENC624J600. They are 10/100 Mbps units, however they also have a lower SPI clock speed (14 MHz)! If you went to a parallel bus (either 8 or 16 pins) they would be a win, but for now the classic enc28J60 seems to be my best bet.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • Patrick1abPatrick1ab Posts: 136
    edited 2009-11-11 18:11
    lonesock said...
    ... but for now the classic enc28J60 seems to be my best bet.

    I would agree to this, if only the enc28j60 had the TCP Stack included. It's really slowing everything down when the propeller has to execute these extra lines of code.

    Edit: I already thought about putting another µC between the propeller and the enc which could be programmed to handle the TCP and which would only need one clock cycle / command instead of four.

    Post Edited (Patrick1ab) : 11/11/2009 6:21:14 PM GMT
  • lonesocklonesock Posts: 917
    edited 2009-11-11 18:15
    Good point. Fortunately for me, my application is UDP only, so there is very little overhead. [noparse][[/noparse]8^)

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • Patrick1abPatrick1ab Posts: 136
    edited 2009-11-11 23:03
    Okay, now it's working...

    The problem seemed to be that I connected the reset pin directly (just with a resistor in between) to the 3.3V source. Now I've added a capacitor to allow the W5100 to do a power on reset. I know, that this is very primitive and surely won't work if the time between switch off and switch on is too short for the capacitor to unload.

    Now the ping request of the computer is successful and the SimpleTCPServer is also working.

    Only my own webserver program which I tried to modify (enc->w5100) isn't working yet. cry.gif

    Post Edited (Patrick1ab) : 11/12/2009 5:00:59 PM GMT
  • DynamoBenDynamoBen Posts: 366
    edited 2009-11-13 03:00
    Patrick1ab when you have a moment post your functioning driver, I want to make sure we are working with the same code.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-11-15 18:19
    Thanks Paul Sr, it is nice to feel missed. I got lots of great things I want to do with the W5100, but right now I am buried in my day job.

    I can understand the reasoning for savings of pins for SPI versus Parallel connections. I guess it depends on the application and the other system hardware requirements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • Patrick1abPatrick1ab Posts: 136
    edited 2009-11-17 22:42
    Oh, this is extremely frustrating... Yes, I got my webserver working, BUT:

    1. it is very slow
    2. sometimes there are still errors in the transmission (see the corrupted jpeg image for example)
    3. and when my computer finishes loading a website, it disappears and my browser shows: "The connection to the server was reset while the page was loading..."

    I'll post the latest version of the driver... If anyone has an idea how to improve it / fix it, please try to do so.
    664 x 479 - 50K
  • DynamoBenDynamoBen Posts: 366
    edited 2009-11-17 23:12
    Patrick1ab said...
    Oh, this is extremely frustrating... Yes, I got my webserver working, BUT:

    1. it is very slow
    2. sometimes there are still errors in the transmission (see the corrupted jpeg image for example)
    3. and when my computer finishes loading a website, it disappears and my browser shows: "The connection to the server was reset while the page was loading..."

    I'll post the latest version of the driver... If anyone has an idea how to improve it / fix it, please try to do so.

    I'm investigating the RX/TX routines, this is where the greatest slowdown can occur. Either these need to be trimmed in SPIN or moved into ASM (some or all).
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-11-17 23:26
    It will always be slow until at least the SPI code is in pasm

    My testing showed minimum 61us for Spin to toggle a bit. Pasm can do it in 50ns if you use XOR.
    DynamoBen said...
    Patrick1ab said...
    Oh, this is extremely frustrating... Yes, I got my webserver working, BUT:

    1. it is very slow
    2. sometimes there are still errors in the transmission (see the corrupted jpeg image for example)
    3. and when my computer finishes loading a website, it disappears and my browser shows: "The connection to the server was reset while the page was loading..."

    I'll post the latest version of the driver... If anyone has an idea how to improve it / fix it, please try to do so.

    I'm investigating the RX/TX routines, this is where the greatest slowdown can occur. Either these need to be trimmed in SPIN or moved into ASM (some or all).
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
    Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • DynamoBenDynamoBen Posts: 366
    edited 2009-11-17 23:32
    Bill Henning said...
    It will always be slow until at least the SPI code is in pasm

    The SPI code is in PASM, what concerns me is the TX/RX methods which are fairly lengthy and in SPIN.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-11-18 00:31
    I just took a quick peek...

    The good news:

    Nice, readable code

    The bad news:

    you will be limited to <10KB/sec with that code.

    in(), out(), calling it for every byte sent (i know you have to send the address), spin overhead etc leads to very slow code - like you suspected.

    I am afraid that ideally ALL of TX and RX need to be re-coded in PASM

    at the very least the inner loop, that transfers X bytes, must be re-written - but for "good" speed, it all must be re-written.

    You could probably double the speed if you did an in2() and out2(), where these new calls did not need the new command and address bytes, and would increment the address in pasm

    that way, all you need to send/get is the payload byte

    if they did the whole loop, you could probably go 10x faster

    DynamoBen said...
    Bill Henning said...
    It will always be slow until at least the SPI code is in pasm

    The SPI code is in PASM, what concerns me is the TX/RX methods which are fairly lengthy and in SPIN.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
    Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • DynamoBenDynamoBen Posts: 366
    edited 2009-11-18 01:47
    Bill and I are on the same page. Personally I would start with Bill's suggestion that stays in SPIN but longer term the important parts of the driver may need to move to PASM. The building blocks are there to get the TX/RX into PASM.

    I'm posting the latest version of the driver for anyone who wants to take a stab at it....good progress so far considering we are gluing two different drivers together.

    NOTE: I've added in a small portion of code in the start method for Reset Pin control. Comment it out if you like

    Post Edited (DynamoBen) : 11/18/2009 2:42:06 AM GMT
  • ParsecParsec Posts: 20
    edited 2009-11-18 12:23
    Glad you all are hashing through this, I've got 2 projects ramping up that require network connectivity and you might be saving me hours of reinventing the wheel! I ordered 3 different NICs to experiment with, the PropNIC ucontroller.com/documentation/PropNICDoc.html the Futurelec board www.futurlec.com/Mini_Ethernet.shtml (both using the ENC28J60) and the Wiznet WIZ812MJ.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No electrons were harmed while rendering this message.
  • DynamoBenDynamoBen Posts: 366
    edited 2009-12-08 04:40
    I've been busy with things leading up to the Holidays and haven't picked this back up. Anything new as of late?
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-12-08 04:56
    I am afraid I am too busy (PropellerBasic, LAS, Largos, Morpheus, consulting) to do more than keep track of this thread and offer suggestions... however I did pick up two MJ821 modules to play with in the future.
    DynamoBen said...
    Bill and I are on the same page. Personally I would start with Bill's suggestion that stays in SPIN but longer term the important parts of the driver may need to move to PASM. The building blocks are there to get the TX/RX into PASM.

    I'm posting the latest version of the driver for anyone who wants to take a stab at it....good progress so far considering we are gluing two different drivers together.

    NOTE: I've added in a small portion of code in the start method for Reset Pin control. Comment it out if you like
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
    Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • DynamoBenDynamoBen Posts: 366
    edited 2009-12-09 03:05
    Fair enough once things calm down I will get back to it. I've started restructuring things to speed the driver up but haven't finished it.
  • DynamoBenDynamoBen Posts: 366
    edited 2009-12-27 20:18
    With the recent release of PropBASIC I may try rewriting the driver with PropBasic which in theory should speed things up.
Sign In or Register to comment.