Shop OBEX P1 Docs P2 Docs Learn Events
New Feature for WIZnet driver - Socket Memory Size Adjustment, please test — Parallax Forums

New Feature for WIZnet driver - Socket Memory Size Adjustment, please test

Timothy D. SwieterTimothy D. Swieter Posts: 1,613
edited 2012-11-16 08:42 in Accessories
I've started coding the ability to adjust the socket memory size in the W5100. My work will concentrate on the Indirect driver first and once that is working I will copy over the work to the SPI driver.

My work will be logged regularly to the Google Code repository.

Thus far I have the foundation set and I need to review it with fresh eyes. After the review I will start to modify the rxTCP, txTCP, rxUDP and txUDP and do some testing on my bench. After all appears to be OK, I'll upload for ya'll to hack at.

At this time this feature will be implemented mainly in SPIN. Eventually this feature would be a candidate for migrating to ASM.

Comments

  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2011-01-26 05:12
    Tonight I've done further integration of this new feature. In fact, the Indirect Driver has had the feature fully implemented and is now ready for the community to try. In the Indirect Driver you will find the following:
    '***************************************
    PUB InitSocketMem( _template) | temp0
    '***************************************
    '' Initialize the socket memory of the W5100.  The W5100 has a total of 8kb for rx memory and 8kb for tx memory.
    '' This memory can be assigned in 1kb, 2kb, 4kb and 8kb increments.  Memory assignments starts at socket 0 and work
    '' towards socket 3 and if there isn't enough memory left for a socket, the socket doesn't get any and shouldn't
    '' be used.
    ''
    '' Users are welcome to add their own templates to fit their design.
    ''
    '' This design assumes that the rx and tx registers are identically sized, but they don't have to be.
    ''
    ''  params:  _template              
    ''
    ''  return:  none
    

    Also updated is the W5100_TCP_Server_Echo_Demo_indirect.spin to include a use of the new PUB.

    Please download the latest code and try it out. You don't have to use the new PUB, as the W5100 (and the start/stop method) automatically configure at 2K each socket. Please post any bug or problems here so I can review and help out. Remember this code is only in the Indirect Driver at this time. Once the code has been proven a bit it will be copied to the SPI driver.
  • bigsleepbigsleep Posts: 1
    edited 2011-02-01 09:46
    I haven't tested your changes yet, but I like having the ability to adjust the configuration.

    Why did you choose to go the template route instead of just using parameters to set the configuration? I can see some value in the simplicity of choosing a pre-defined template. However, this approach requires changing the code to add additional templates. Eventually the driver could become bloated with lots of different configurations.

    I personally would prefer to specify the config through arguments to InitSocketMem. For example: InitSocketMem(W5100#_2KB, W5100#_2KB, W5100#_2KB, W5100#_2KB) for the default config where the rx and tx buffers are the same. This obviously could be expanded to 8 arguments allowing complete access to the configuration. More flexibility at the expense of some complexity for the user, but this would probably only be used by advanced users anyway.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2011-02-01 15:35
    bigsleep - thank you for the response!

    Your suggestion for using arguments to run the socket configuration instead of the currently implemented template idea has merit. The template version was the easiest version to get running without overwhelming the user to think about the allocation of memory. Stated another way, one has to understand how the W5100 memory works and that they can't allocate 8k to each receive or send socket so they shouldn't do that. I was protecting the user in a minor way by offering templates. When I coded up the tests I didn't take time to code checking logic which would be needed to verify arguments, so I did the easy template route. However I am certainly open to changing this as I agree that the arguments method would allow for more flexibility (and potentially more trouble) but it would be keep the code small and be extensible from four to eight parameters so there could be the ultimate configuration.
  • Mag748Mag748 Posts: 266
    edited 2012-11-14 08:44
    Hello,

    I am wondering if any work has been done on the W5100 SPI driver to incorporate these additional memory allocation features. Currently, the driver goes off into the weeds if used with modified memory allocations. I have not looked at the indirect diver to see if the work has been done there, but will look there and integrate those changes or make my own modifications if no one has already taken the plunge.

    Thanks,
    Marcus
  • Mag748Mag748 Posts: 266
    edited 2012-11-16 08:42
    I have attached the modified code that I am using successfully.

    Thanks,
    Marcus

    W5100_SPI_Driver 11.14.12.spin
Sign In or Register to comment.