Shop OBEX P1 Docs P2 Docs Learn Events
W5200 code assitance — Parallax Forums

W5200 code assitance

DynamoBenDynamoBen Posts: 366
edited 2012-10-09 07:31 in Propeller 1
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.

Comments

  • KyeKye Posts: 2,200
    edited 2012-06-20 14:17
    You should be able to get 20 Mhz write and 10 Mhz read with the prop chip.

    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.
  • DynamoBenDynamoBen Posts: 366
    edited 2012-06-20 14:43
    Kye wrote: »
    You should be able to get 20 Mhz write and 10 Mhz read with the prop chip.

    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.
    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.

    So are you suggesting that I might be as fast as I can get?
  • KyeKye Posts: 2,200
    edited 2012-06-20 21:12
    It's 4 clock cycles per instruction. You're not getting better than 20 MHz. If you want more speed then increase the main clkfreq.

    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.
  • DynamoBenDynamoBen Posts: 366
    edited 2012-06-21 06:59
    Thanks for the insights, I will abandon increasing the SPI speed then.
  • DynamoBenDynamoBen Posts: 366
    edited 2012-09-06 15:17
    Update: Another user found a way to speed things up and I've posted the updated version to the obex.
  • DynamoBenDynamoBen Posts: 366
    edited 2012-10-08 20:32
    DynamoBen wrote: »
    Update: Another user found a way to speed things up and I've posted the updated version to the obex.

    This same user found yet another way to speed things up by implementing burst mode on the W5200, v1.2 is posted...enjoy.
  • pgbpsupgbpsu Posts: 460
    edited 2012-10-09 06:57
    Hi Ben-

    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
  • DynamoBenDynamoBen Posts: 366
    edited 2012-10-09 07:18
    pgbpsu wrote: »
    Hi Ben-

    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?

    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.
  • pgbpsupgbpsu Posts: 460
    edited 2012-10-09 07:22
    Hi Ben-

    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
  • DynamoBenDynamoBen Posts: 366
    edited 2012-10-09 07:31
    pgbpsu wrote: »
    Hi Ben-

    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.
Sign In or Register to comment.