Azure NetX Duo only provides the driver for LAN8742 compatible Ethernet PHYs. How can I manage other Ethernet PHYs?

733 Views Asked by At

I'm developing an application for STM32F4 with Azure RTOS Netx Duo. In particular I'm trying to adapt the example Nx_TCP_Echo_Server application for my board where is present the Ethernet Phy ADIN1200 produced by Analog Devices.

Note about example Nx_TCP_Echo_Server

The Nx_TCP_Echo_Server example application has been made for a STM32F429ZI-NUCLEO demo board (code of Nx_TCP_Echo_Server on github).
In the demo board STM32F429ZI-NUCLEO the Ethernet Phy is compatible with the lan8742 driver (see the lan8742 driver code on GitHub). Unfortunately the Ethernet PHY ADIN1200 present on my board is not compatible with that driver.

I have noted that the sixth parameter of the function nx_ip_create() is the pointer function nx_stm32_eth_driver. This pointer function points to lan8742 driver.
Below I show the invocation of the function nx_ip_create() present in the file app_netxduo.c (code of app_netxduo.c) of the Nx_TCP_Echo_Server example application:

/* Create the main NX_IP instance */
  ret = nx_ip_create(&IpInstance, "Main Ip instance", NULL_ADDRESS, NULL_ADDRESS, &AppPool, nx_stm32_eth_driver,
                     pointer, 2 * DEFAULT_MEMORY_SIZE, DEFAULT_PRIORITY);

The documentation of NetX Duo reports the following info:

The NX_IP structure contains everything to manage a single IP instance. This includes general TCP/IP protocol information as well as the application-specific physical network driver's entry routine. The driver's entry routine is defined during the nx_ip_create service. Additional devices may be added to the IP instance via the nx_ip_interface_attach service.

My development environment

My development environment is composed by:

  • STM32CubeMX version 6.7.0
  • In the STM32CubeMX I have installed the Package STM32F4 version 1.27.1
  • To use ThreadX I have added to CubeMX the software pack X-CUBE-AZRTOS-F4 version 1.1.0

By the previous environment I can find only the driver for LAN8742.

My question

How can I find other Ethernet PHY drivers for NetX Duo other than the one for lan8742?


EDIT

I have found this driver for ADIN1200 but it is very far from the driver lan8742.c provided by my development tool (see the code of lan8742).
In fact the API of the 2 drivers are very different; for example NetX Duo (and before it: LwIP) needs a function like LAN8742_RegisterBusIO() (present in the LAN8742 driver) to init a structure with pointer functions useful to write and read registers of the Ethernet PHY, but in this driver this function and its data structures are not present.

1

There are 1 best solutions below

4
Tiejun Zhou On

You can find different phy drivers from https://github.com/azure-rtos/samples.

  • mimxrt1060:KSZ8081RNB
  • same54:KSZ8091RNA 
  • stm32f746:LAN8742A-CZ-TR
  • rx65n rsk:DP83620SQE

For others, you will need to develop the driver by yourself, based on existing ones.