lwip 1.4 - DM9161A PHY

After reading topic http://mbed.org/forum/mbed/topic/3684/?page=1#comment-18473, i created the lpc_phy_DM9161A.c file (used lpc_phy_lan8720.c as a template).

Partially working

Auto negotiation and DHCP are OK - ethernet communication is not working.

There seems to be a communication problem between the EMAC and PHY (timing?). Any ideas on how to resolve this issue are welcome.

A debug log is available at /media/uploads/frankvnk/tcpsocket_helloworld_with_dm9161a_phy_-_debug_log.txt. The log file indicates a pbuf problem. Further investigation led me to following webpage: http://www.lpcware.com/content/forum/lwip-sample-fail#comment-1785. I tried again with the mentioned modification but then DHCP does not work. I don't know if this modification also needs to be implemented (not present in the current lwip library).

How to test

import http://mbed.org/users/mbed_official/code/TCPSocket_HelloWorld/ into the mbed compiler.

Goto folder EthernetInterface\lwip-eth\arch#

Delete lpc_phy_dp83848.c.

Copy lpc_phy_DM9161A.c into this folder.

Add following MAC address definition in main.cpp (before 'EthernetInterface eth;').

       extern "C" void mbed_mac_address(char * mac)
       {
       // define your own MAC Address
         mac[0] = 0x00;  
         mac[1] = 0x1F;  
         mac[2] = 0x33;  
         mac[3] = 0x42;  
         mac[4] = 0xFC;  
         mac[5] = 0x6F;           
       };

When used with the Mini-DK hardware

Modify EthernetInterface\lwip-eth\arch\lpc_emac_config.h:

Change #define LPC_PHYDEF_PHYADDR 1 to #define LPC_PHYDEF_PHYADDR 19

On the Mini-DK, sometimes no IP address is obtained when the 'Reset' button is pressed after programming the device. Disconnect and reconnect the device and press the 'Reset' button again to restart.