W5500 Socket Status

Use this section to discuss your embedded Flowcode projects.
Post Reply
Qualcomm5
Posts: 11
http://meble-kuchenne.info.pl
Joined: Wed Dec 20, 2023 2:13 pm
Has thanked: 6 times
Been thanked: 4 times

Flowcode v10 W5500 Socket Status

Post by Qualcomm5 »

I'm successfully connecting/testing W5500 networked comms with PuTTY terminal (RAW) via single socket '0'. However, the actual meaning of 'Socket Status' from the component is somewhat elusive, with no supporting information.

I'm returning socket status value via debug UART in 0.5s loop cycles, with the following decimal values returned for each status...

Default from boot (socket created): 20 (0b10100)

On terminal connect (1st message): 23 (0b10111), sustained whilst connected.

On terminal disconnect (PuTTY closed): 28 (0b11100)

After a minute or-so: 0 (0b00000), reconnect refused.

As I could do with understanding this information for appropriate socket management (i.e. close/open socket reset after remote terminal closure), is anyone aware of associated status bit values and how to reliably interpret them please?

Thanks and best regards,
Brendan

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: W5500 Socket Status

Post by BenR »

Hi Brendan,

The status is basically reading the Status Register of the W5500 IC.

Sn_SR (Socket n Status Register) [R] [0x0003]

The datasheet here, specifically pages 49 and 50 tell you what the values mean.

https://cdn.sparkfun.com/datasheets/Dev ... .0.2_1.pdf

Maybe we can put some more diagnostics in place in the component to help determine the meanings.

Qualcomm5
Posts: 11
Joined: Wed Dec 20, 2023 2:13 pm
Has thanked: 6 times
Been thanked: 4 times

Re: W5500 Socket Status

Post by Qualcomm5 »

Thank you Ben, that's great.

No issues at-all with this, now I can be confident with the information presented. Working like a charm now, merely checking if link status > 23d and immediately resetting the affected port well before timeout in the main program loop :)

I believe this info to be important in both confirming link establishment and resetting broken links for re-establishment, so either verbose summary or deconstruct of returned info from socket status would doubtless be useful - thank you.

All the best,
Brendan

Post Reply