Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1781

Re: Uthernet II W5100 auto-increment

From ol.sc@web.de (Oliver Schmidt)
Newsgroups comp.sys.apple2.programmer
Subject Re: Uthernet II W5100 auto-increment
Date 2015-08-01 14:01 +0000
Organization albasani.net
Message-ID <mpijf9$7p9$1@news.albasani.net> (permalink)
References <dog_cow-1437427269@macgui.com> <14c20f7e-fc62-46d2-a440-b9f9c3f9bdd3@googlegroups.com> <dog_cow-1437522089@macgui.com>

Show all headers | View raw


Hi David,

>>> I can't get auto-increment for addresses in the W5100 to work. I'm using
>>> $03
>>> as the Mode byte. Anyone know? This is really quite a setback!

Mode $03 is correct - and auto-increment is supposed to work.

>> I couldn't get it stable on my home-brew Wiznet card, but I figured it was
>> because of my wiring mess. To get around it, I set the register address
>> before every read/write. Not what I wanted, but it works.

Getting auto-increment to work correctly seems to be much harder with
the W5100 than with the CS8900A or the LAN91C96.

I know of two prototpyes for the C64 both suffering from
auto-increment not fully working too. One was even a professionally
produced PCB:
http://www.forum64.de/wbb3/index.php?page=Attachment&attachmentID=36052&thumbnail=1&embedded=1

>That's what the Contiki/ ip65 driver is doing.

Certainly not ! I have no idea how anybody could come to that
conclusion ?!?

The Contiki / IP65 driver is fully speed-optimized and as such
precalculates W5100 buffer wraparounds and partial page transfers in
order to end up in tight loops for the actual data transfer. Here's
the loop for writing data to the W5100. The "sta data" writes to the
W5100 and triggers the auto-increment:

: lda (ptr),y
  sta data
  iny
  bne :-
  inc ptr+1
  dex
  bpl :-
  rts

BTW: There's no need for comments telling me that I could spare one
cycle by replacing the indirect zeropage addressing with self
modifying code. I already know that ;-)

Some additional notes:

- Right after verifying that I could successfully initialize the W5100
one of my first test programs was an explicit auto-increment stress
test. It writes 8kB of a pattern to the W5100 buffer, reads it back
and compares it with the original pattern.

- The Contiki / IP65 driver uses auto-increment not only for the
actual data transfer but also for programming the W5100. I.e. setting
the MAC address in the W5100 looks like this:

  ldx #$00
  ldy #$09
  jsr set_addr
: lda mac,x
  sta data
  inx
  cpx #$06
  bcc :-

Or setting two consecutive socket specific registers looks like this:

  ldy #$00
  jsr set_addrsocket0
  lda #$44
  sta data
  lda #$01
  sta data

To summarize: Glenn and I were from the beginning in agreement that a
fully working auto-increment is a must-have for the Uthernet II. If he
wouldn't have managed to get it working reliably we wouldn't have
continued with the W5100!

> I am *not* happy about this. :-(
>
>I was hoping to get my driver for Marina completed this past weekend, but I
>stopped when I found I could not get auto-increment to work.

Something about your hardware and/or software setup has an issue.

By the way: The Contiki / IP65 driver for the W5100 is fully
speed-optimized and uses the W5100 in the 'MAC raw mode' bypassing its
builtin TCP/IP stack. The goal of this driver is to use the W5100 a
drop-in replacement for the CS8900A (and LAN91C96) - and being as fast
as those drivers.

I additionally wrote a fully size-optimized driver using the W5100 in
'UDP mode':
https://github.com/oliverschmidt/ip65/blob/master/supplement/w5100_udp.s

That driver makes even more use of the auto-increment for W5100
programming. Every comment "; -> addr is already set" means that
auto-increment was used to get/set consecutive W5100 registers.

Regards,
Oliver

Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Uthernet II W5100 auto-increment D Finnigan <dog_cow@macgui.com> - 2015-07-20 21:19 +0000
  Re: Uthernet II W5100 auto-increment David Schmenk <dschmenk@gmail.com> - 2015-07-20 21:46 -0700
    Re: Uthernet II W5100 auto-increment D Finnigan <dog_cow@macgui.com> - 2015-07-21 23:40 +0000
      Re: Uthernet II W5100 auto-increment David Schmenk <dschmenk@gmail.com> - 2015-07-29 06:41 -0700
        Re: Uthernet II W5100 auto-increment D Finnigan <dog_cow@macgui.com> - 2015-07-30 20:35 +0000
      Re: Uthernet II W5100 auto-increment ol.sc@web.de (Oliver Schmidt) - 2015-08-01 14:01 +0000
        Re: Uthernet II W5100 auto-increment D Finnigan <dog_cow@macgui.com> - 2015-08-04 23:21 +0000
          Re: Uthernet II W5100 auto-increment ol.sc@web.de (Oliver Schmidt) - 2015-08-09 14:27 +0000
            Re: Uthernet II W5100 auto-increment spectrumdaddy@nospam.com (Ewen) - 2015-08-10 07:43 +0100
              Re: Uthernet II W5100 auto-increment D Finnigan <dog_cow@macgui.com> - 2015-08-10 14:32 +0000

csiph-web