A40i Application Notes: Three Frequently Encountered NIC Software Problems and Troubleshooting Ideas
Although there is only one network port on the Forlinx Embedded OKA40i-C EVK, the Allwinner A40i-H processor has two network controllers, so there is a dual network port solution in the datasheet offered by Forlinx Embedded. Engineers may encounter some NIC design problems. We will share three kinds of NIC software problems that appear easy when using the OKA40i-C EVK and troubleshooting ideas.
01 Problem Analysis
Problem description 1: Ethernet initialization error No phy found
When executing the ifconfig eth0 up command, the "No phy found" exception log appears.
The common reason for "No phy found" is that the 25M clock used for phy is abnormal, which causes phy to work abnormally, and the gmac driver can't read the phy device information through the mdio interface.
If the MDIO pin configuration or phy address is incorrect, then MDIO doesn't do the pull-up resistor, and GMAC can not read the phy device information. We can use an oscilloscope to measure if the MDIO waveform is correct, or if the phy chip reset fails, it needs to replace the phy chip reset pull-up resistor.
- (1) Check the phy power supply status;
- (2) Check the 25M clock (Soc ephy25M or external crystal) used by phy;
- (3) Check if the phy-mode is configured according to the actual board level (mii/rmii/rgmii).
- (4) Check the MDIO for pull-up resistors;
- (5) Check the MDIO pins configuration;
- (6) Is the eMAC phy address consistent with the hardware;
- (7) Check that the reset pull-up resistor is consistent with the schematic reference scheme.
MDIO communication is verified as normal:
We can use the phytool tool to read the 0x02 0x03 register. Successful reading of PHY chip ID means the MDIO communication is normal.
Problem description 2: Ethernet initialization error NO SUCN DEVICE
Execute the command ifconfig -a/ifconfig eth0/ifconfig eth0 up. the eth0 device is not found.
The Ethernet module configuration is not in effect or there is a GPIO conflict.
Step 1: Capture the kernel boot log, search for the "gmac" key field, and check whether the gmac driver has been probed successfully;
Step 2: If the kernel boot log shows mac controller probe failure, the common cause is due to GPIO resource conflict.
GPIO conflict will have an error message, according to the error, check the GPIO conflict pins.
Check the Ethernet module configuration.
Problem description 3: Ethernet initialization error Initialize hardware error
Execute the ifconfig eth0 up command and the "Initialize hardware error" exception log appears.
Initialize hardware error" appears, usually because the phy does not output RX CLK to the MAC controller, resulting in a soft reset failure within the MAC controller.
Common causes are phy abnormal power supply or 25M clock. Alternatively, we can check data pin clock, and RMILL RX CLK TX CLK.
Grab the rx_clk clock waveform with an oscilloscope to see if the clock remains stable at 25M; and if it appears to jump back and forth at 25M/2.5M. That is, MAC and phy are not linked successfully.
Software can link successfully by setting register 0 fixed to 100M full duplex after phy reset. Problem solution:
Add phy_write(phydev, 0x0, 0x2100) before phy_connect_direct in geth_phy_init function in drivers/net/ethernet/allwinner/sunxi-gmac.c.
The following are common NIC design issues in the OKA40i-C EVK development, some of which may be due to configuration issues when referencing the solution or improper output signals from the chip. When referring to the dual network port solution for the OKA40i-C EVK, you may refer to the issues summarized in this article for solving the problems in your projects.
The following are some troubleshooting methods for common NIC software problems.
02 Troubleshooting Methods
These methods may provide you with some debugging ideas for phy. The tools mentioned in the following article may help you quickly find and solve NIC problems.
(1) Check that menuconfig and dts Ethernet configuration are turned on;
(2) Check whether the phy-mode configuration matches the physical interface between the PHY and GMAC, such as rgmii, rmii, and so on;
(3) Check if the GPIO configuration is correct, such as IO multiplexing function, driving capability, etc;
(4) Verify that the MDIO is correct by reading the phy ID with the phytool tool.
As shown below, the JL11x1 phy ID reading normal means MDIO communication is normal.
Use the phytool tool to read the phy status register and view the phy chip status. Take JL11x1 as an example: if the 0x01 status register reads the 0x786d indicating the link is successful and can work properly.
That’s all OKA40i-C SBC dual-network port NIC software problem analysis and troubleshooting direction. Hoping it is helpful for your project development.