For now, code is only working upto the initialisation (Auto negotiation and obtain IP address) - Ethernet communication is not working (system locks up after IP address is obtained). I had to change non-blocking read/write to blocking read/write to obtain a working initialisation. I think there is a timing problem because when i enable several printf's or enable debug options, the test program continues but errors are returned (probably also related to the non-blocking code). Setting the emac-phy clock to its lowest does not resolve the issue.
Has anyone already used the DM9161A PHY (together with lwip1.4 + rtos) or has ideas on what could cause this problem? I already searched the web extensively for DM9161A code - found several (different) examples but none seems to resolve my issue.