This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Ethernet cable insertion detection

Hello,

I need to make sure that my LPC2478 will configure its DHCP only after the physical insertion of the Ethernet cable into the controller (it seems that TCPNet cannot handle a situation where a DHCP enabled controller is startup without a network connection, thus the need to configure TCPNet again or for the firs time once the cable is inserted. Note: of the controller already got an IP address, then had his cable disconnected, there is no problem). It seems that simple interrupt detection won't do the job. Any ideas?

Parents
  • Tamir,

    The 'init_ethernet' gets called during the initialisation of the TCPnet. The Keil implementation (through conditional compilation) configures the PHY and MAC.

    If auto-discrimination is selected, the routine waits for either 1) success or 2) a large timeout. If success, then fine. If timeout, then assume some fixed parameters and continue as it sees fit.

    My code triggers the auto-discrimination of the PHY (if that is the required option) and then exits. The timeslot is then called periodically to check the status of the PHY. If a new connection is made, it reads the parameters and sets the MAC accordingly. If a connection is lost, it re-triggers an auto-negotiation.

    The timeslot also takes a snapshot of Ethernet parameters (speed, duplex, connection). These details are available through a 'status' call so I can check them within the main application.

    I used a timeslot (that is called from the same task that maintains the TCP) because I do not know what the TCPnet does internally [thanks to the crazy pricing of Keil's TCPnet sourcecode!] and I did not want to interfere with it's workings. It could have been done in ways other than a timeslot, but I think it all turned out rather neat. I need to do a little more checking, but so far it looks like a worthwhile effort.

    Sorry, but I think code is too big to post here.

Reply
  • Tamir,

    The 'init_ethernet' gets called during the initialisation of the TCPnet. The Keil implementation (through conditional compilation) configures the PHY and MAC.

    If auto-discrimination is selected, the routine waits for either 1) success or 2) a large timeout. If success, then fine. If timeout, then assume some fixed parameters and continue as it sees fit.

    My code triggers the auto-discrimination of the PHY (if that is the required option) and then exits. The timeslot is then called periodically to check the status of the PHY. If a new connection is made, it reads the parameters and sets the MAC accordingly. If a connection is lost, it re-triggers an auto-negotiation.

    The timeslot also takes a snapshot of Ethernet parameters (speed, duplex, connection). These details are available through a 'status' call so I can check them within the main application.

    I used a timeslot (that is called from the same task that maintains the TCP) because I do not know what the TCPnet does internally [thanks to the crazy pricing of Keil's TCPnet sourcecode!] and I did not want to interfere with it's workings. It could have been done in ways other than a timeslot, but I think it all turned out rather neat. I need to do a little more checking, but so far it looks like a worthwhile effort.

    Sorry, but I think code is too big to post here.

Children