W5200 code assitance
DynamoBen
Posts: 366
I recently ported the wiznet W5100 driver to work with the newer W5200.
http://obex.parallax.com/objects/869/
One of the features of the W5200 is a faster SPI buss (80mhz instead of 10mhz). The problem I'm having is if I speed up the clock and/or I remove the nops in the ASM SPI code I can no longer communicate with the IC. If someone can help me figure out how to speed things up I would be grateful.
http://obex.parallax.com/objects/869/
One of the features of the W5200 is a faster SPI buss (80mhz instead of 10mhz). The problem I'm having is if I speed up the clock and/or I remove the nops in the ASM SPI code I can no longer communicate with the IC. If someone can help me figure out how to speed things up I would be grateful.
Comments
Look at the ASM SPI functions in the bottom of the Full File Sytem Driver found here http://obex.parallax.com/objects/619/. Also, FSRW has some very fast SPI functions.
The prop chip cannot do any better than the SPI functions in FSRW. The SPI functions in the Full File System driver I referenced are a bit easier to read as they are more general purpose.
FSRW has the best SPI rountines for 512*8 bit reads and writes.
This is true and was working in the W5100, and is the same way in the W5200 that I ported. I'm trying to go faster, I don't expect that I will be able to reach 80Mhz but more then 20Mhz would be great.
So are you suggesting that I might be as fast as I can get?
Yeah, i know, it's lame. But, there's no hardware to do parallel to serial output and input.
If you use the video generator you want write data faster than 20 MHz. You're not going to be able to do better than 10 MHz or 20 MHz for reading, however.
...
Usually, SPI bus transfer speeds aren't the bottle neck. Unless you are getting near the theoretical bit rate you can get an 10 MHz, let's say... then you should spend your time somewhere else in the code.
This same user found yet another way to speed things up by implementing burst mode on the W5200, v1.2 is posted...enjoy.
I see the updated code. Nicely commented and well done. Looking it over it appears the top read only/write only speed is 20Mhz. Is that correct? You're last post (#7) makes me think there might be an additional speed up. Can you clarify?
Thanks,
Peter
The additional speed comes from "burst mode" which is unique to the W5200 and was implemented in this release. Burst mode allows you to write 40bits for the first byte and then 8bits for each consecutive byte (previously it wrote 40bits for every byte), which means an overall increase in read/write speed.
Thanks for clarifying. So this is a speed up for this device, but not a speed up in the SPI bit clock (read or write). Nicely done driver.
p
Correct, this driver is about 2.5 times faster than the W5100 driver.
While I can take credit for the original rework I can't for the speed increases, you can see in the header that those changes where done by Jim St John.