Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

W5500 Network status

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Thu Dec 15, 2022 4:01 pm    Post subject: W5500 Network status Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Thu Dec 15, 2022 4:13 pm    Post subject: Re: W5500 Network status Reply with quote

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
View user's profile Visit poster's website
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Thu Dec 15, 2022 6:01 pm    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Fri Dec 16, 2022 10:46 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Tue Dec 20, 2022 11:55 am    Post subject: Reply with quote

Hi Mark,

thank you for your reply.
works fine:

Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum