µTasker Forum

µTasker Forum => µTasker general => Topic started by: thamanjd on April 28, 2008, 09:42:15 AM

Title: Will a TCP session disconnect as soon as it detects physical link lost?
Post by: thamanjd on April 28, 2008, 09:42:15 AM
does pulling the cat 5 cable out of a utasker project prompt a utasker TCP session to disconnect? I'd like to make this happen if it is not the case. What should i poll to see if link is still there?

Title: Re: Will a TCP session disconnect as soon as it detects physical link lost?
Post by: mark on April 28, 2008, 10:10:51 AM
Hi

The TCP protocol is not aware of the link status and will still try to transmit. Of course after a few repeats the connection will be closed.

When the link state changes, there is an event generated:
- define INTERRUPT_TASK_PHY to be the name of the task wich you would like to receive the event
- 3 Interrupt events will then be sent to this task (LAN_LINK_DOWN, LAN_LINK_UP_100 and LAN_LINK_UP_10)

In th edemo project this is optionally sent to TASK_NETWORK_INDICATOR and used to control the link LED (LED colour set to indicate link up with a specific speed).

By retaining a variable which is changed depending on these events you will always have a reference to the link's state and so it will not be necessary to poll. When the link goes down (LAN_LINK_DOWN) you can immediately undertake your active connection close.

Regards

Mark
Title: Re: Will a TCP session disconnect as soon as it detects physical link lost?
Post by: Lukas on June 20, 2008, 12:30:37 PM
Hi Mark.

I want to implement in my project an event when the link state change.
Whre are these Interrupts Events from? I looked through your code, but can't find it anywhere.
Title: Re: Will a TCP session disconnect as soon as it detects physical link lost?
Post by: mark on June 20, 2008, 06:05:46 PM
Lukas

I was a bit too general with my statement about these events.

They are defined in driver.h
#define LAN_LINK_UP_100             0xff
#define LAN_LINK_UP_10              0xfe
#define LAN_LINK_DOWN               0xfd


but they are not used in all projects. The reason is that some of the evaluation boards do not connect the PHY interrupt line so it really has not been implemented.

I did a quick search of all projects and am sure that this is available in the following:
- M5223X, NE64, SAM7X
I think that it is available in the Luminary project (not sure whether it has been fully tested)
I am note sure about the STR91XF since I don't think that the interrupt from the PHY chip was working.
I known that it is not in the LPC23XX project because neither Olimex nor IAR boards have the IRQ line wired up.

I expect that you are using the LPC23XX project (?) since the event is really missing there. A solution would be to poll the PHY or else to modify the board and add the interrupt - I don't know why it is not connected on these EVBs but the best solution would of course be to add a HW patch (there are enough free interrupt pins) and then integrate the event generation in the PHY IRQ.

Regards

Mark
Title: Re: Will a TCP session disconnect as soon as it detects physical link lost?
Post by: Lukas on June 24, 2008, 08:09:03 AM
Hallo Mark.
Yes, you are right, my board is an Olimex board.
I wondered why I can't find it. That's the reason, no interrupt line.
Ok, then I try to make my own line.  :)

Thanks
Lukas