This week I continue testing the board. Trying to fix the OSI layer of PIC32 with LAN8720.

Studying different board behavior with same code

I first started with programming the rest of the board with the same code and realize that the current board I am using have a different behavior compare to the other 4. In other words, with probability and statistic the board I am currently using should be faulty while the other 4 are fine, with that in mind I switch to use one of the potential non-faulty board to proceed with my experiment.

Clock Configuration setting

I studied the datasheet and ethernet application for PIC32 to try to learn how to write a physical connection for an external phy. Referring to several sources and forums on getting the initialization code on PIC with LAN8720. Most of the sources out there uses PIC32MX and LAN8720. But the concept is almost the same (I am using PIC32MZ). Since I discover that the problems lies on the clock configuration I set resulting different RJ45 LED behavior, I first make sure I write the correct clock system using Harmony. After confirming the clock system was correctly initialize as in input 24MHz from oscillator on CLKI, with POSC configuration, internal SPLL driver to produce 200MHz internally for all pheripheral devices and output CLKO 100MHz for FPGA and 50MHz as reference clock output for LAN8720.

LAN8720 Intitalization

With the clock configuration done, I proceed with LAN8720 initialization code. I studied the old library (MLA – microchip library application) from microchip to compare the code on LAN8720 with HARMONY. However I realize both initialization are almost the same. Therefore I just emphasize on studying all the configuration of HARMONY on internal mac (since its the internal mac setting that generate’s the LAN820 init code). Building the empty project with only clock and lan8720 init code, I found out I have a physical connection.


Next referring to TCPIP example from HARMONY I write a simple TCP server code, burn it into the board, and magic happens, I manage to ping the board and have feedback. PIC32 is able to communicate with LAN8720 with IPV4 protocol up and running, the OSI layeris works.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.