Porting LAN8720A to i.MXRT1050

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Porting LAN8720A to i.MXRT1050

Porting LAN8720A to i.MXRT1050

i.MXRT1050 MCU supports 10M/100M Ethernet MAC. Nowadays, LAN8720A is a very common PHY used in many networking design. In this document, I will show you how to use LAN8720A with i.MXRT1050. 

1. Schematic

pastedImage_10.png

pastedImage_11.png

 

pastedImage_12.png

In this design example, 

  • ENET_RST  is connected to GPIO_AD_B1_04     
  • ENET_INT is connected to GPIO_AD_B0_15     

2. Source code modification

In the i.MXRT1050 SDK, the source code files of the PHY are fsl_phy.c and fsl_phy.h. The registers of LAN8720A need to be added into the source code. Below is the registers of LAN8720A. The details can be found in the LAN8720A datasheet.

pastedImage_23.png

( The modified fsl_phy.c and fsl_phy.h are attached)

 

In the pinmux.c, modify the GPIO Mux setting of the ENET_INT and ENET_RST.

  IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_04_GPIO1_IO20, 0U);                                   

  IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_15_GPIO1_IO15, 0U);                                   

  IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_04_GPIO1_IO20, 0xB0A9u);                               

  IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_15_GPIO1_IO15, 0xB0A9u);                              

This is the part of the source code to reset the PHY in the main() function.

gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};

GPIO_PinInit(GPIO1, 20, &gpio_config);

GPIO_PinInit(GPIO1, 15, &gpio_config);

GPIO_WritePinOutput(GPIO1, 15, 1);

GPIO_WritePinOutput(GPIO1, 20, 0);

delay();

GPIO_WritePinOutput(GPIO1, 20, 1);

For more example codes, please refer to the demo_apps/lwip in the i.MXRT SDK package.

Reference:

i.MXRT1050 web page : i.MX RT1050 MCU/Applications Crossover Processor | Arm® Cortex®-M7 @600 MHz, 512KB SRAM |NXP 

MCUXpresso SDK web page : MCUXpresso SDK|NXP 

Attachments
Comments

There is no driver code for LAN8720A chip in the i.MXRT1050 SDK provided on the official website.

No ratings
Version history
Last update:
‎10-24-2018 11:43 PM
Updated by: