WizNet W5100
DynamoBen
Posts: 366
I'm posting to see how many ppl are using the W5100 in their projects. More importantly if anyone has a decent driver for it using SPI?
At the moment I'm using the Hydra driver, while comprehensive its not very fast. The project I'm working on is listening to a UDP stream that sends data at 1.4-1.6MBps. I had considered marrying the Hydra driver spin code with the SPI_ASM object to see if that would speed things up, but wanted to see if anyone else had done work on this first or had thoughts on the matter.
At the moment I'm using the Hydra driver, while comprehensive its not very fast. The project I'm working on is listening to a UDP stream that sends data at 1.4-1.6MBps. I had considered marrying the Hydra driver spin code with the SPI_ASM object to see if that would speed things up, but wanted to see if anyone else had done work on this first or had thoughts on the matter.
Comments
anyway both are high bandwiths.
As you have to do some SPI-overhead this might be to fast for the propeller. But I'm not sure.
In other threads some high-speed serial connections are discussed if I remember right for simple serial bitbanging
the were at 1.7MBs and 10 MBs (don't remember byte or bits per second)
If you have to do a lot of SPI-overhead (which I don't know) it might be too fast
Maybe the experts about SPI can chime in ?
best regards
Stefan
I've been working with the ENC28J60-Chip until now, using the latest TCP/IP-Stack programmed by Harrison Pham and the fsrw-object to read from sd-card.
My "Webserver" with these two SPIs reached a maximum speed of 690 KBits/sec which is 86,25 KBytes/sec.
And now look at this bandwidth provided by the hydra driver: 7.8 KBytes/sec
I can't really understand why it's so slow.
Okay, the buffer size of 2 KBytes is surely one part of this problem (I'm working with 4 KBytes on the ENC28J60 at the moment),
but it doesn't explain a bandwidth loss by a factor of eleven.
This really isn't the fault of the WizNet I believe its the driver I'm using. You can extend the size of the buffer, its 2K per socket by default, in software. Now you understand my request for something better. What kind of numbers are you shooting for?
Post Edited (DynamoBen) : 10/28/2009 12:18:14 AM GMT
Yeah, I do
But still, I don't understand where the bottleneck of this driver is ...
The source code of the ENC28J60 driver + TCP/IP Stack is much bigger and has a lot more instructions to be processed by the propeller.
I'll try to find a solution tomorrow comparing the different SPI implementations.
It would be great, if I could get 1.5 MBits/sec. But I don't know if that's possible ...
Post Edited (Patrick1ab) : 10/28/2009 12:37:18 AM GMT
This is a great point, I will have to speed a little time in the ENC driver also to see how its different.
Try using that technique for the other driver - then it will fly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Good tip, thanks!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Using this technique in combination with the wiznet “unit of 32-bit stream," which means each 32bit stream contains one data byte. I believe we should be able to write @ 625K databytes/sec and read @ 312.5K databytes/sec (20,000,000/32 - 10,000,000/32). Do my numbers look correct?
Post Edited (DynamoBen) : 10/30/2009 6:11:04 PM GMT
Assuming 20MHz for write and 10Mhz for read we should see about 546.875K databytes/sec for reading overall.
Post Edited (DynamoBen) : 10/30/2009 6:10:20 PM GMT
This is what I have so far, the spin portion is mostly the Hydra code, and the PASM is a modified version of the ENC code. This is very raw and untested...I'm sending while I'm still working on it but thought it might give you a boost.
Way to go!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
For comparison, the best SPI clock frequency I could get with a PASM bit-bang loop was ~2.5MHz best case. Using counters gets you clkfreq/4, which is 8 times faster.
Post Edited (Harrison.) : 10/30/2009 7:42:48 PM GMT
Thanks a lot, but it seems I have to fight hardware problems first
Has anyone of you got some experience on how the W5100 reacts when you connect the supply voltage and a network cable (no software/driver started).
My WIZ812MJ-Board seems to recognize the connection to the computer, but Link- and TX/RX-LEDs are both flashing every few seconds and my computer shows
connection...no connection...connection...no connection...etc.
Is this behavior normal, when no initialization has took place? Otherwise I have to assume that my constant voltage regulator is damaged or that I have cold solder joint somewhere.
This is very normal. It won't do a thing until it has a mac, ip, gateway, and subnet mask. Use the hydra driver to test your setup and assign these items.
I already checked the voltage regulator and it's fine, so I'll try to load the hydra driver now.
I was working on the driver and wondered why my scope suddenly stopped showing Clock-Signal, MOSI, etc. . Then I realized that I couldn't program my Propeller Chip anymore and already thought I had killed it.
After a while I found out, that the 3.3 V constant voltage regulator of my demo board isn't working properly anymore. It delivers 2.7 V to the Propeller Chip which is the minimum voltage (checking the Propeller's datasheet), but the Propeller won't work in a stable condition at this minimum voltage.
I hoped that it was just the overload protection (although I can't imagine why it should set off) which is described in the voltage regulators datasheet, but the problem is still there after waiting some time.
Now I have to find a way to replace it... and I hate replacing SMD-Parts with more than 2 connections
Forget what I wrote about the voltage regulator. Luckily I checked the switching power supply, which came with my Propeller Demo Board aswell and found out, that it only delivers 4.1V DC although it should have an output of 7.5V DC.
Post Edited (Patrick1ab) : 11/3/2009 1:44:18 AM GMT
Finally, after all my hardware problems, i started testing the early version of your driver:
Looking at the output of my scope, I can see that the assembler part of the driver seems to recognize that there is a "command" as a parameter (otherwise it would stay in the subloop forever => no change of cspin),
but it is not able to recognize which type of command it is. So the programm stays in the main loop without jumping to spi_out_ or xspi_in_
I tried to work on this problem, but my knowledge of assembler is very limited. Especially when it comes to shifting of bits.
Its a work in progress and frankly I didn't expect that it would work since the code is incomplete. I'm trying to stitch together to very different drivers into one working driver, which isn't always easy. The problem is at the moment I'm in the mist of another project and can't give this a lot of attention. However I hope to get back to it soon.
There are some issues we should think about:
1. I'm not sure whether the W5100 can handle a 20MHz SPI, as in the datasheet the minimum SCLK time is 70 ns (20MHz is equal to 50 ns).
2. Is it necessary to connect the Reset pin? I would like to keep the interface as simple as possible so I commented out the parts where the Reset pin was defined.
In the attachments you'll also find a simple test program I wrote to check the SPI communication:
It tries to read the ip address which is currently set, write a new ip address to the W5100 and then reads it again to check whether or not writing has been successful.
Note that you'll have to connect a tv in order to see the results of this test.
I think this is a spin versus ASM issue. The spin code was written for the WizNet whereas the AMS was written for the ENC, that relationship needs "smoothing over".
I hadn't seen this, what page? Its always easier to go slower [noparse];)[/noparse]
I'd like to say the reset is unneeded but I won't know for sure until I do some more testing and development.
After some bugfixes in the assembler part and a few modifications in the "in" function, I was able to read and write data with my test program.
The only major problem left is that there are still some SPI timing or speed difficulties. Sometimes the data is written and read back correctly, the next time an error occurs.
You can find this on page 65 of the W5100 datasheet.
Do you think we can go to a 14.285714 MHz SPI Clock? I know that this is mathematically questionable.
I will try to measure the input and output setup and hold times aswell, although I don't think that these are so critical.
Edit: This is absolutely crazy... I switched everything off and went to a presentation and now when I returned the driver won't work anymore (it's not even writing false data). I'm pretty sure I saved everything and even wrote the program into the eeprom.
Post Edited (Patrick1ab) : 11/10/2009 10:36:27 PM GMT
I had this issue too when I was originally editing the code, it worked for hours but then would stop. Make sure the reset pin is tied correctly, a floating reset could do this.
Good news so far. The only thing I can think of is change the clock of the out to 10Mhz (like the in) and add a nop between each of the rol commands. The nop will burn up the 4 clocks necessary for 10Mhz.
Post Edited (DynamoBen) : 11/10/2009 11:13:20 PM GMT
lol... That's exactly what I did in the meantime
Now the SPI communication works perfectly, but it seems I have some difficulties establishing a connection to my router/pc.
Do you know which value should be set as source port while calling "open"?
The destination port should be 80 (webserver) and the destination ip is unknown, so I have set it to 0.0.0.0
At the moment my webserver is listening, but conn_est never becomes true.
Post Edited (DynamoBen) : 11/11/2009 2:03:14 AM GMT
Thanks That's what I needed