PIC32MZ with KSZ8873MLL
I’m new to this forum. For the last couple of days I’m searching for a solution to my problem, unfortunately I failed.
I have a custom made board for establishing an Ethernet connection between the board and my home router, so for that following components were selected:
1. PIC32MZ1024EFK064 – as my microcontroller.
2. KSZ8873MLL – as an Ethernet switch which have 2 10/100 PHY ports and one MII port.
The soldering and bring up of both microcontroller and switch were completed successfully, and when my PC is connected to the switch I got connection to internet (one PHY is connected to my router and another to my PC) and can browse the net pretty well.
The real problem comes here, I connected the microcontroller to the switch via the MII interface, and using MHC I configured the TCP/IP stack. When the program is executed the stack is not initialised properly, and the function TCPIP_STACK_Init(); returns = SYS_MODULE_OBJ_INVALID. So I debugged the code for a while and found that the code access both DUPLEX bit and LOOP BACK bit in basic control register of KSZ8873 for checking the PHY communication. And when referred errata (got from one of the discussions in a forum) I came to know that bits 8 (and this bit is the duplex bit), 12 and 13 of basic control register can’t be written using MIIM, so I think this is why the stack is not getting initialised properly. By making a slight modification in the stack (skipped writing operation of bit 8) the whole thing get initialized successfully. But There is no sign of connection to the router, since am not getting the IP (DHCP client getting time out), and when I used the wire shark application, I didn’t found any communication between PIC32 Ethernet and router (even the DHCP discover messages sent by the controller), so I again get stuck.
Few more things I suspect:
1. Actually the MHC do not have a driver for KSZ8873, instead it have driver of KSZ8863, and I just ticked that and generated the code (since both ICs register map is same). I don’t know whether this makes any problem.
2. I saw some strap options in the switch. And I kept them in there default state.
Please help me with this problem.
Thanks in advance.