EmbeddedRelated.com
Forums

Duplex mode

Started by "see...@yahoo.com [rabbit-semi]" September 16, 2015
The RCM3900 is capable of both half and full duplex mode for Ethernet. I believe that configuration is done during network negotiation. I don't need to set some #define or the like to get full duplex mode to work do I?

Steve
I've gone through the Rabbit network libs and didn't see any #define options for selecting duplex mode. I ask only because a customer is saying the module is only communicating half-duplex and I keep saying the duplex mode is set in the auto-negotiation process. Am I wrong?

I believe the RCM3000 only supports half-duplex whereas the RCM3900 supports both.

Steve
There is a note at the start of the realtek.lib file about this and it references TN237 which no longer seems to be on the Digi site but can be found at http://www.cika.com/soporte/Information/Rabbit/AppNotes/TN237.pdf http://www.cika.com/soporte/Information/Rabbit/AppNotes/TN237.pdf.

Reading this, it seems they don't recommend running the Realtek RTL8019AS in full duplex mode but you can define the RT_FULLDUPLEX macro if you are feeling brave...

Regards,
Peter
On 9/19/2015 6:43 AM, p...@yahoo.com [rabbit-semi] wrote:
>
> There is a note at the start of the realtek.lib file about this and it
> references TN237 which no longer seems to be on the Digi site but can
> be found at
> http://www.cika.com/soporte/Information/Rabbit/AppNotes/TN237.pdf.
>
> Reading this, it seems they don't recommend running the Realtek
> RTL8019AS in full duplex mode but you can define the RT_FULLDUPLEX
> macro if you are feeling brave...
>

The RCM3900 uses the Asix chip, not the Realtek.
--
------
Scott G. Henion, Consultant
Web site: http://SHDesigns.org
------


Posted by: Scott Henion



As I recall, the Realtek chip on the RCM3000 does not support auto-negotiation. The FD/HD control is a bit in one of the configuration registers.

The ASIX chip on the RCM3900 supports auto-negotiation, and it is enabled by default. This can be overridden by a control field in one of the PHY control registers though, so that would be the place to look.

Monte
Steve,

It looks like asix_networkmode() in tcpip/ASIX.LIB (the driver used by the RCM3900, as shown in tcpip/BOARD_DEPS.LIB) supports a parameter for setting half or full duplex.

-Tom

From: r... [mailto:r...]
Sent: Wednesday, September 16, 2015 2:08 PM
To: r...
Subject: [rabbit-semi] Duplex mode

The RCM3900 is capable of both half and full duplex mode for Ethernet. I believe that configuration is done during network negotiation. I don't need to set some #define or the like to get full duplex mode to work do I?

Steve

,_._,___
Tom,
I saw function asix_networkmode(), and tried unsuccessfully to follow the code to see what mode was being set.
In net_defs.lib is the following define:
#define PD_NETWORK_MODE 110   // int, int (speed, duplex)
I can't figure out how to decipher the value of 110.
And in ASIX.LIB, in function asix_ioctl() is a large switch statement that uses the define in one of the cases:
#ifdef PD_NETWORK_MODE
 ;case PD_NETWORK_MODE:
  ld  hl, PD_NETWORK_MODE
  xor a
  sbc hl, de
  jp  z, .asix_ioctl_networkmode
#endif

Notice that whatever value is in register de is subtracted from the value 110, with the result placed in hl.
Then function asix_ioctl_networkmode() is called where the first statement wipes out whatever value was in hl. So now what?
#ifdef PD_NETWORK_MODE
.asix_ioctl_networkmode:
 ;case PD_NETWORK_MODE
  ;return asix_networkmode(nic, *(int *) stack, *(int *) (stack + sizeof(int)));
  ld  hl, (sp+@sp+stack)
  ld  hl, (hl+sizeof(int))
  push hl
  ld  hl, (sp+@sp+stack+2)
  ld  hl, (hl)
  push hl
  ld  hl, (sp+@sp+nic+4)
  push hl
  asix_internal_call(asix_networkmode)
  add sp, 6
  ld  (sp+@sp+retval), hl
  jr  .asix_ioctl_return
#endif

So I have no clue as to what mode is being set.
Steve

From: "'Tom Collins' t...@tomlogic.com [rabbit-semi]"
To: r...
Sent: Wednesday, September 23, 2015 11:55 AM
Subject: RE: [rabbit-semi] Duplex mode

  Steve,  It looks like asix_networkmode() in tcpip/ASIX.LIB (the driver used by the RCM3900, as shown in tcpip/BOARD_DEPS.LIB) supports a parameter for setting half or full duplex.  -Tom  From: r... [mailto:r...]
Sent: Wednesday, September 16, 2015 2:08 PM
To: r...
Subject: [rabbit-semi] Duplex mode    The RCM3900 is capable of both half and full duplex mode for Ethernet.  I believe that configuration is done during network negotiation. I don't need to set some #define or the like to get full duplex mode to work do I?  Steve,_._,___ #yiv3984947364 #yiv3984947364 -- #yiv3984947364ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv3984947364 #yiv3984947364ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv3984947364 #yiv3984947364ygrp-mkp #yiv3984947364hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv3984947364 #yiv3984947364ygrp-mkp #yiv3984947364ads {margin-bottom:10px;}#yiv3984947364 #yiv3984947364ygrp-mkp .yiv3984947364ad {padding:0 0;}#yiv3984947364 #yiv3984947364ygrp-mkp .yiv3984947364ad p {margin:0;}#yiv3984947364 #yiv3984947364ygrp-mkp .yiv3984947364ad a {color:#0000ff;text-decoration:none;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ygrp-lc {font-family:Arial;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ygrp-lc #yiv3984947364hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ygrp-lc .yiv3984947364ad {margin-bottom:10px;padding:0 0;}#yiv3984947364 #yiv3984947364actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv3984947364 #yiv3984947364activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv3984947364 #yiv3984947364activity span {font-weight:700;}#yiv3984947364 #yiv3984947364activity span:first-child {text-transform:uppercase;}#yiv3984947364 #yiv3984947364activity span a {color:#5085b6;text-decoration:none;}#yiv3984947364 #yiv3984947364activity span span {color:#ff7900;}#yiv3984947364 #yiv3984947364activity span .yiv3984947364underline {text-decoration:underline;}#yiv3984947364 .yiv3984947364attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv3984947364 .yiv3984947364attach div a {text-decoration:none;}#yiv3984947364 .yiv3984947364attach img {border:none;padding-right:5px;}#yiv3984947364 .yiv3984947364attach label {display:block;margin-bottom:5px;}#yiv3984947364 .yiv3984947364attach label a {text-decoration:none;}#yiv3984947364 blockquote {margin:0 0 0 4px;}#yiv3984947364 .yiv3984947364bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv3984947364 .yiv3984947364bold a {text-decoration:none;}#yiv3984947364 dd.yiv3984947364last p a {font-family:Verdana;font-weight:700;}#yiv3984947364 dd.yiv3984947364last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv3984947364 dd.yiv3984947364last p span.yiv3984947364yshortcuts {margin-right:0;}#yiv3984947364 div.yiv3984947364attach-table div div a {text-decoration:none;}#yiv3984947364 div.yiv3984947364attach-table {width:400px;}#yiv3984947364 div.yiv3984947364file-title a, #yiv3984947364 div.yiv3984947364file-title a:active, #yiv3984947364 div.yiv3984947364file-title a:hover, #yiv3984947364 div.yiv3984947364file-title a:visited {text-decoration:none;}#yiv3984947364 div.yiv3984947364photo-title a, #yiv3984947364 div.yiv3984947364photo-title a:active, #yiv3984947364 div.yiv3984947364photo-title a:hover, #yiv3984947364 div.yiv3984947364photo-title a:visited {text-decoration:none;}#yiv3984947364 div#yiv3984947364ygrp-mlmsg #yiv3984947364ygrp-msg p a span.yiv3984947364yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv3984947364 .yiv3984947364green {color:#628c2a;}#yiv3984947364 .yiv3984947364MsoNormal {margin:0 0 0 0;}#yiv3984947364 o {font-size:0;}#yiv3984947364 #yiv3984947364photos div {float:left;width:72px;}#yiv3984947364 #yiv3984947364photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv3984947364 #yiv3984947364photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv3984947364 #yiv3984947364reco-category {font-size:77%;}#yiv3984947364 #yiv3984947364reco-desc {font-size:77%;}#yiv3984947364 .yiv3984947364replbq {margin:4px;}#yiv3984947364 #yiv3984947364ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv3984947364 #yiv3984947364ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv3984947364 #yiv3984947364ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv3984947364 #yiv3984947364ygrp-mlmsg select, #yiv3984947364 input, #yiv3984947364 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv3984947364 #yiv3984947364ygrp-mlmsg pre, #yiv3984947364 code {font:115% monospace;}#yiv3984947364 #yiv3984947364ygrp-mlmsg * {line-height:1.22em;}#yiv3984947364 #yiv3984947364ygrp-mlmsg #yiv3984947364logo {padding-bottom:10px;}#yiv3984947364 #yiv3984947364ygrp-msg p a {font-family:Verdana;}#yiv3984947364 #yiv3984947364ygrp-msg p#yiv3984947364attach-count span {color:#1E66AE;font-weight:700;}#yiv3984947364 #yiv3984947364ygrp-reco #yiv3984947364reco-head {color:#ff7900;font-weight:700;}#yiv3984947364 #yiv3984947364ygrp-reco {margin-bottom:20px;padding:0px;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ov li a {font-size:130%;text-decoration:none;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv3984947364 #yiv3984947364ygrp-sponsor #yiv3984947364ov ul {margin:0;padding:0 0 0 8px;}#yiv3984947364 #yiv3984947364ygrp-text {font-family:Georgia;}#yiv3984947364 #yiv3984947364ygrp-text p {margin:0 0 1em 0;}#yiv3984947364 #yiv3984947364ygrp-text tt {font-size:120%;}#yiv3984947364 #yiv3984947364ygrp-vital ul li:last-child {border-right:none !important;}#yiv3984947364
Steve,

I believe 110 is just used to uniquely identify the ioctl. I'm not looking at the other code, but DE probably holds the ioctl number to match. That assembly code is essentially comparing DE to 110, and jumping to asix_ioctl_networkmode if they match.

The second section takes parameters from the stack, re-pushes them on the stack and calls the underlying function.

Take a look at pd_networkmode() in PKTDRV.LIB to see the linkage. I believe this is all so you can have a single API (pd_*) that maps to multiple network drivers depending on what the underlying hardware is.

Bottom line for you, though, is that pd_networkmode() is the generic function you can use to change the duplex setting. Looking at ASIX.LIB from Dynamic C 10.72 (the only version I have on this computer right now), I would say that you can't change the default, startup duplex setting with a macro.

Try using pd_networkmode() to change the duplex setting before your ifconfig() calls to bring the interface up, or before calling sock_init(). You may need to experiment a bit to get the calling order right, in case sock_init() or ifconfig() overwrite your duplex setting.

-Tom
On Sep 24, 2015, at 9:19 AM, Steve Trigero s...@yahoo.com [rabbit-semi] wrote:
> Tom,
>
> I saw function asix_networkmode(), and tried unsuccessfully to follow the code to see what mode was being set.
>
> In net_defs.lib is the following define:
>
> #define PD_NETWORK_MODE 110 // int, int (speed, duplex)
>
> I can't figure out how to decipher the value of 110.
>
> And in ASIX.LIB, in function asix_ioctl() is a large switch statement that uses the define in one of the cases:
>
> #ifdef PD_NETWORK_MODE
> ;case PD_NETWORK_MODE:
> ld hl, PD_NETWORK_MODE
> xor a
> sbc hl, de
> jp z, .asix_ioctl_networkmode
> #endif
>
> Notice that whatever value is in register de is subtracted from the value 110, with the result placed in hl.
>
> Then function asix_ioctl_networkmode() is called where the first statement wipes out whatever value was in hl. So now what?
>
> #ifdef PD_NETWORK_MODE
> .asix_ioctl_networkmode:
> ;case PD_NETWORK_MODE
> ;return asix_networkmode(nic, *(int *) stack, *(int *) (stack + sizeof(int)));
> ld hl, (sp+@sp+stack)
> ld hl, (hl+sizeof(int))
> push hl
> ld hl, (sp+@sp+stack+2)
> ld hl, (hl)
> push hl
> ld hl, (sp+@sp+nic+4)
> push hl
> asix_internal_call(asix_networkmode)
> add sp, 6
> ld (sp+@sp+retval), hl
> jr .asix_ioctl_return
> #endif
>
> So I have no clue as to what mode is being set.
>
> Steve
>