W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

User avatar
Eugeny
Posts: 248
Joined: Sat Apr 25, 2015 7:08 pm
Location: Moscow, Russia
Contact:

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby Eugeny » Sun Mar 19, 2017 3:43 am

Youngtao, while I was focusing on the data throughput, I forgot issue related to ping having about 18 ms response. Ping performance has nothing to do with host driver/data performance, thus there really seems to be a problem.

I have W5100 custom board, just have run test to ensure that it replies within less than 1 ms to the nearby PC's ping response. TX/RX buffer size does not affect ping response performance (as far as I see in my test). Thus I decided to take a look onto your driver code, finding out that you use WIZnet standard driver. I also see the following line in dev.c

Code: Select all

iinchip_outb(REG_TMODE, TMODE_PINGBLOCK | TMODE_NOSIZECHK_RAW);

however bit 2 is indicated to be *reserved* in the datasheet, searching for it gave me the following source https://github.com/borg42/w5x00/blob/master/dev.c saying the following

Code: Select all

1483  // TMODE_NOSIZECHK_RAW (0x04) is defined as "reserved" in w5500 as well as w5x00 datasheet! wtf?
1484  iinchip_outb(lp->regs.REG_TMODE, TMODE_PINGBLOCK /*| TMODE_NOSIZECHK_RAW*/);

I would also disable this TMODE_NOSIZECHK_RAW bit setting in your driver (we can see it as being the undocumented functionality).

Further, I ask you please perform dump or whole "common register block" (0x0-0x39) after W5500 initialization is finished by the driver (e.g. before the driver goes to establishing/listening mode) - so that we can see which settings all the registers have and try to figure out potential issues.

youngtao
Posts: 11
Joined: Tue Mar 14, 2017 2:20 pm

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby youngtao » Mon Mar 20, 2017 11:10 am

Eugeny wrote:Youngtao, while I was focusing on the data throughput, I forgot issue related to ping having about 18 ms response. Ping performance has nothing to do with host driver/data performance, thus there really seems to be a problem.

I have W5100 custom board, just have run test to ensure that it replies within less than 1 ms to the nearby PC's ping response. TX/RX buffer size does not affect ping response performance (as far as I see in my test). Thus I decided to take a look onto your driver code, finding out that you use WIZnet standard driver. I also see the following line in dev.c

Code: Select all

iinchip_outb(REG_TMODE, TMODE_PINGBLOCK | TMODE_NOSIZECHK_RAW);

however bit 2 is indicated to be *reserved* in the datasheet, searching for it gave me the following source https://github.com/borg42/w5x00/blob/master/dev.c saying the following

Code: Select all

1483  // TMODE_NOSIZECHK_RAW (0x04) is defined as "reserved" in w5500 as well as w5x00 datasheet! wtf?
1484  iinchip_outb(lp->regs.REG_TMODE, TMODE_PINGBLOCK /*| TMODE_NOSIZECHK_RAW*/);

I would also disable this TMODE_NOSIZECHK_RAW bit setting in your driver (we can see it as being the undocumented functionality).

Further, I ask you please perform dump or whole "common register block" (0x0-0x39) after W5500 initialization is finished by the driver (e.g. before the driver goes to establishing/listening mode) - so that we can see which settings all the registers have and try to figure out potential issues.


tkx so much, Eugeny, i will catch the reg ASAP.

youngtao
Posts: 11
Joined: Tue Mar 14, 2017 2:20 pm

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby youngtao » Mon Mar 20, 2017 3:41 pm

Eugeny wrote:Youngtao, while I was focusing on the data throughput, I forgot issue related to ping having about 18 ms response. Ping performance has nothing to do with host driver/data performance, thus there really seems to be a problem.

I have W5100 custom board, just have run test to ensure that it replies within less than 1 ms to the nearby PC's ping response. TX/RX buffer size does not affect ping response performance (as far as I see in my test). Thus I decided to take a look onto your driver code, finding out that you use WIZnet standard driver. I also see the following line in dev.c

Code: Select all

iinchip_outb(REG_TMODE, TMODE_PINGBLOCK | TMODE_NOSIZECHK_RAW);

however bit 2 is indicated to be *reserved* in the datasheet, searching for it gave me the following source https://github.com/borg42/w5x00/blob/master/dev.c saying the following

Code: Select all

1483  // TMODE_NOSIZECHK_RAW (0x04) is defined as "reserved" in w5500 as well as w5x00 datasheet! wtf?
1484  iinchip_outb(lp->regs.REG_TMODE, TMODE_PINGBLOCK /*| TMODE_NOSIZECHK_RAW*/);

I would also disable this TMODE_NOSIZECHK_RAW bit setting in your driver (we can see it as being the undocumented functionality).

Further, I ask you please perform dump or whole "common register block" (0x0-0x39) after W5500 initialization is finished by the driver (e.g. before the driver goes to establishing/listening mode) - so that we can see which settings all the registers have and try to figure out potential issues.


hi,Eugeny,
the all log of device is attached, which include the all common REG value at the last several line just like this:
<6>[ 131.559261] *************SOCKET NO.:0, COMMON REG (0x000000) VAULE:0x14
Attachments
sucomreg.zip
(23.91 KiB) Downloaded 3 times

User avatar
Eugeny
Posts: 248
Joined: Sat Apr 25, 2015 7:08 pm
Location: Moscow, Russia
Contact:

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby Eugeny » Tue Mar 21, 2017 12:38 am

Youngtao, so what we have here....

MR (0) = 0x14. As I said in previous post try with bit 2 reset (so that it is 0x10).
GAR (1-4) = 0,0,0,0. W5500 uses gateway address to direct specific requests, for example it may perform some ARP queries to gateway. If there's a gateway, set its address so that W5500's requests to it would be properly fulfilled.
SUBR (5-8) = 0,0,0,0. This setting is ok if there's no router (in your config GAR=0), thus *I think* GAR and SUBR all zeros, from standard point of view, should be ok, but it is a good question how these values are handled by W5500 internally. I never tried this way, I always had gateway and subnet mask (but I always use internet which requires router, in your case you just connect two devices without "outer world", right?). Nevertheless, if there's gateway in your setup, set subnet mask appropriately (as well as GAR).
SHAR (9-e) = 0,8,dc,91,97,98, looks like valid MAC address with no special bits set.
SIRP (f-12) = 0,0,0,0. From now on I think that you took the dump of the W5500 when it is not configured yet.
We need dump of fully configured W5500 when it is expected to answer ping requests.

Quickly on other regs:
SIMR (18) = 0x1, interrupts from socket 0 are enabled
RTR and RCR are default (7d0 and 8 respectively)
PHY (2e) = 0xba, configured by pins, all capable, current connection is 100MBit, and link is down! So, in addition to incomplete configuration, chip is disconnected from the LAN.

I also see the following:

Code: Select all

<6>[  131.566781] sock:0 SOCK_STATUS = 0x42 , Protocol = 0x14

where status of 0x42 is

Code: Select all

0x42 / SOCK_MACRAW / This indicates Socket 0 is opened in MACRAW mode (S0_MR(P[3:0]) = 0100)and is valid only in Socket 0. It changes to SOCK_MACRAW when S0_MR(P[3:0] = 0100 and OPEN command is ordered.

So you are going to communicate using RAW mode, not TCP and not UDP-with-header modes, right?

Also looking at your log output

Code: Select all

<6>[  131.559261] *************SOCKET NO.:0, COMMON REG (0x000000) VAULE:0x14

I would say you may confuse socket registers and common registers. Common registers set operating mode of the chip, socket registers set operating mode of the socket. Then I suspect that this is why you initialize socket 0 in MACRAW mode writing the same value 0x14 to S0_MR as well as to MR.

Please check carefully and reply with your findings.

youngtao
Posts: 11
Joined: Tue Mar 14, 2017 2:20 pm

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby youngtao » Wed Mar 22, 2017 11:28 am

Eugeny wrote:Youngtao, so what we have here....

MR (0) = 0x14. As I said in previous post try with bit 2 reset (so that it is 0x10).
GAR (1-4) = 0,0,0,0. W5500 uses gateway address to direct specific requests, for example it may perform some ARP queries to gateway. If there's a gateway, set its address so that W5500's requests to it would be properly fulfilled.
SUBR (5-8) = 0,0,0,0. This setting is ok if there's no router (in your config GAR=0), thus *I think* GAR and SUBR all zeros, from standard point of view, should be ok, but it is a good question how these values are handled by W5500 internally. I never tried this way, I always had gateway and subnet mask (but I always use internet which requires router, in your case you just connect two devices without "outer world", right?). Nevertheless, if there's gateway in your setup, set subnet mask appropriately (as well as GAR).
SHAR (9-e) = 0,8,dc,91,97,98, looks like valid MAC address with no special bits set.
SIRP (f-12) = 0,0,0,0. From now on I think that you took the dump of the W5500 when it is not configured yet.
We need dump of fully configured W5500 when it is expected to answer ping requests.

Quickly on other regs:
SIMR (18) = 0x1, interrupts from socket 0 are enabled
RTR and RCR are default (7d0 and 8 respectively)
PHY (2e) = 0xba, configured by pins, all capable, current connection is 100MBit, and link is down! So, in addition to incomplete configuration, chip is disconnected from the LAN.

I also see the following:

Code: Select all

<6>[  131.566781] sock:0 SOCK_STATUS = 0x42 , Protocol = 0x14

where status of 0x42 is

Code: Select all

0x42 / SOCK_MACRAW / This indicates Socket 0 is opened in MACRAW mode (S0_MR(P[3:0]) = 0100)and is valid only in Socket 0. It changes to SOCK_MACRAW when S0_MR(P[3:0] = 0100 and OPEN command is ordered.

So you are going to communicate using RAW mode, not TCP and not UDP-with-header modes, right?

Also looking at your log output

Code: Select all

<6>[  131.559261] *************SOCKET NO.:0, COMMON REG (0x000000) VAULE:0x14

I would say you may confuse socket registers and common registers. Common registers set operating mode of the chip, socket registers set operating mode of the socket. Then I suspect that this is why you initialize socket 0 in MACRAW mode writing the same value 0x14 to S0_MR as well as to MR.

Please check carefully and reply with your findings.


hi,Eugeny,

we set and dump the common reg again by PC linked directly, and now it doesn't work to the timeout, in our opinion, there must be something block the ping echo reply packet, maybe it's some function such as iinchip_mac_rx_tasklet() .

and from the "ping block" (0x10)description of DS, it means there is no reply to ping request ? could we disable it by setting 0bit?

the 5500 chip have a function of auto reply ping, could we open it to check the 5500 is running ok in our device especially the chip pin is ok.

by the way the new common register list is attached, please check it. tkx.
BR.
YOUNGTAO
Attachments
reglog.zip
(687 Bytes) Downloaded 3 times

User avatar
Eugeny
Posts: 248
Joined: Sat Apr 25, 2015 7:08 pm
Location: Moscow, Russia
Contact:

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby Eugeny » Wed Mar 22, 2017 5:30 pm

From my perspective log looks fine now.
And you have checked it still has 20 ms delay in reply to ping request?

I still see

Code: Select all

<6>[   83.356338] sock:0 SOCK_STATUS = 0x42 , Protocol = 0x14

You still initialize socket in RAW mode. Please open socket 0 in TCP mode setting S0_MR into 0x21, and then giving command 0x01 (open) to CR, and only then try pinging W5500.

If ping still gives long time values, I would change course of action - would designed "dummy" driver for W5500, which would only contain the following:
1. software reset (MR bit 7 set to 0, then waiting till this bit resets);
2. set MR to 0x10;
3. set proper GW IP, mask, MAC address, and own IP address;
and that's all - not changing anything else from the defaults. Then I would try to ping W5500 and see result. If it would have the same 20 ms reply, the issue might be not in the chip OR you may have found issue in the chip. If ping will be ok (1ms), then there's some issue in your further chip configuration (e.g. it does not handle single 16KB buffer properly) - and it will require further troubleshooting.

youngtao
Posts: 11
Joined: Tue Mar 14, 2017 2:20 pm

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby youngtao » Thu Mar 23, 2017 11:04 am

Eugeny wrote:From my perspective log looks fine now.
And you have checked it still has 20 ms delay in reply to ping request?

I still see

Code: Select all

<6>[   83.356338] sock:0 SOCK_STATUS = 0x42 , Protocol = 0x14

You still initialize socket in RAW mode. Please open socket 0 in TCP mode setting S0_MR into 0x21, and then giving command 0x01 (open) to CR, and only then try pinging W5500.

If ping still gives long time values, I would change course of action - would designed "dummy" driver for W5500, which would only contain the following:
1. software reset (MR bit 7 set to 0, then waiting till this bit resets);
2. set MR to 0x10;
3. set proper GW IP, mask, MAC address, and own IP address;
and that's all - not changing anything else from the defaults. Then I would try to ping W5500 and see result. If it would have the same 20 ms reply, the issue might be not in the chip OR you may have found issue in the chip. If ping will be ok (1ms), then there's some issue in your further chip configuration (e.g. it does not handle single 16KB buffer properly) - and it will require further troubleshooting.


hi,Eugeny,

we set the socket 0 MR to 0x21 and CR to 0x01, then the network is fail, and the ping is fail too, because that the mac address will not be learned each other, if we use cmd"arp -s x x" to bind the ip and mac by manual, it still doesn't work.that is why set the raw protocol, and now the common register and protocol status is as following:
Attachments
protocol status.zip
(709 Bytes) Downloaded 3 times

youngtao
Posts: 11
Joined: Tue Mar 14, 2017 2:20 pm

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby youngtao » Thu Mar 23, 2017 11:30 am

hi,Eugeny,
the photo is the test result and the tcpdump packet.
BR.
YOUNGTAO
Attachments
IMG_20170323_101111.jpg
IMG_20170323_101111.jpg (4.85 MiB) Viewed 33 times

User avatar
Eugeny
Posts: 248
Joined: Sat Apr 25, 2015 7:08 pm
Location: Moscow, Russia
Contact:

Re: W5500 is running ok,but link PC directly the ping timeout is big (20 ms) and the throughout is just 1Mbps

Postby Eugeny » Fri Mar 24, 2017 12:53 am

Youngtao, I am very sorry, I was mistaken about MR value. Datasheet says

Code: Select all

4 | PB | Ping Block Mode: 0 : Disable Ping block, 1 : Enable Ping block; If the bit is 1, it blocks the response to a ping request.

To be ping-able device should have bit 4 as ZERO, not 1. Thus please, after you software reset the chip with bit 7 (MR <- 0x80), just wait until this bit clears, and no further operation on MR is necessary. When you will have bit 4 of common register "MR" to 0, W5500 will be replying to ping requests.

You actually were already saying that in
youngtao wrote:and from the "ping block" (0x10)description of DS, it means there is no reply to ping request ? could we disable it by setting 0bit?

but I did not read it well.

Next,

Code: Select all

<6>[   74.181856] sock:0 SOCK_STATUS = 0x13 , Protocol = 0x21

you have opened socket (status 0x13) in TCP mode and with no delayed ACK bit set. Good!

So now your task is to connect to the PC using CONNECT command (CR <- 0x04), and if connect is successful, status reg will become 0x17. Then you can send and receive data.

For successful connect PC should listen to the respective destination port in TCP mode. DP (destination port #) should be set in W5500's socket registers 0x10-0x11.

During connection command execution, you should see packet exchange between W5500 and PC - probably several ARP packets, and TCP SYN/ACK packets.

But before proceeding to TCP connect, please check timing of ping to see if it is still 20 ms, or timing has improved.


Return to 쏻5500

Who is online

Users browsing this forum: No registered users and 1 guest