View previous topic :: View next topic |
Author |
Message |
wielklem
Joined: 20 Nov 2008 Posts: 47 Location: the Netherlands
|
Posted: Thu Dec 15, 2022 4:01 pm Post subject: W5500 Network status |
|
|
Something I can not find in the documentation or online;
Is there a simple way to check the actual PHY connection status? For example the Link status?
Because when I boot a W5500 without a network connected it can not build a propper network connection. (Not alway's)
Checking for the socketstat <> &H17 does not always help out I noticed.
For arduino (C coded) I found several sollutions, but within easyTCP I could not. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Thu Dec 15, 2022 4:13 pm Post subject: Re: W5500 Network status |
|
|
wielklem wrote: |
For arduino (C coded) I found several sollutions, but within easyTCP I could not. |
then port this code.
or read the W5500 PDF. i think the register is documented that holds the status and you only need to read this register value. there are statements/functions to read/write registers in the W5500 _________________ Mark |
|
Back to top |
|
|
wielklem
Joined: 20 Nov 2008 Posts: 47 Location: the Netherlands
|
Posted: Thu Dec 15, 2022 6:01 pm Post subject: |
|
|
Hi Albert, see below.
The W5500 registers indeed hold a status that I will check.
never the less, I was wondering if there was a shortcut within easytcp, bu I guess there is not.
chears!
Code: |
Do
Status = Socketstat(idy , 0) 'port status
Waitms 50
incr fail_count
If Status = &H17 Then '&H17 is a TCP connection
fail_count = 0
returnbit = 2
Exit Do
Elseif fail_count = 200 Or Status = &H1C Then
Socketdisconnect Idy
fail_count = 0
returnbit = 1
modeselected = 1
Waitms 50
Goto main
End If
Loop
|
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Fri Dec 16, 2022 10:46 am Post subject: |
|
|
it does not make sense to make a function for each bit since you can use the Gettcpregs function to read any register.
the PHYCFGR register is what you are after, bit 0 contains the link status. _________________ Mark |
|
Back to top |
|
|
wielklem
Joined: 20 Nov 2008 Posts: 47 Location: the Netherlands
|
Posted: Tue Dec 20, 2022 11:55 am Post subject: |
|
|
Hi Mark,
thank you for your reply.
works fine:
|
|
Back to top |
|
|
|