Q&A A40i Network Card Software
OKA40i-C development board has only one network port. However, A40i itself has two network controllers. So there is a dual network port solution in the Manual released by Forlinx Embedded. The following are the questions that may occur in network card design during development process and corresponding troubleshooting methods.
1. Common network card software problems
Question 1: Ethernet initialization error: No phy found
execute ifconfig eth0 up, appears "No phy found" exception log.
Question Analysis:
When "No phy found" appears, the common reason is 25M clock used by phy is abnormal, which causes phy to work abnormally, and gmac driver cannot read phy device information through mdio interface.
Or, MDIO pin configuration is incorrect or phy address is incorrect, and MDIO does not have a pull-up resistor, GMAC cannot read phy device information. Use an oscilloscope to measure whether MDIO waveform is correct.
Or, phy chip reset fails, need to replace phy chip reset pull-up resistor.
Troubleshooting steps:
- (1) Check whether the power supply of phy is normal;
- (2) Check whether 25M clock (Soc ephy25M or external crystal oscillator) used by phy is normal;
- (3) Check whether phy-mode is configured according to the actual board level (mii/rmii/rgmii);
- (4) Check whether MDIO has a pull-up resistor;
- (5) Check whether MDIO pin configuration is correct;
- (6) Whether eMAC phy address is consistent with hardware;
- (7) Check whether reset pull-up resistor is consistent with schematic reference.
MDIO communication verification:
Use phytool to read 0x02 0x03 register to see if PHY chip ID is correctly read. If read is correct, MDIO communication is normal.
Question 2: Ethernet initialization error: NO SUCH DEVICE
execute ifconfig -a/ifconfig eth0/ifconfig eth0 up, eth0 device cannot be found.
Question Analysis:
Ethernet module configuration does not take effect or GPIO conflict.
Troubleshooting steps:
Step 1: Grab kernel startup log, search "gmac", and check whether gmac driver probe successfully;
Step 2: If kernel startup log shows mac controller probe fails, the common reason is the conflict of GPIO resources.
Solution:
There will be an error message for GPIO conflict. According to the error message, check GPIO conflict pin.
Check whether Ethernet module is configured.
Question 3: Ethernet initialization error: Initialize hardware error
Execute ifconfig eth0 up, appears "Initialize hardware error" exception log.
Question Analysis:
"Initialize hardware error" is usually caused by phy does not output RX CLK to MAC controller, which causes internal soft reset failure of MAC controller. The common reason is abnormal phy power supply or abnormal 25M clock; or check whether clock of data pin is correct, whether RMILL RX CLK TX CLK is correct clock.
Troubleshooting steps:
Grab rx_clk clock waveform with an oscilloscope to see if 25M clock is stable. If 25M/2.5M bounces back and forth, MAC and phy are not linked successfully.
Solution:
In software, after phy is reset, set register 0 to be fixed to 100M full-duplex, and the link can be successful. The question can be solved as following:
Add phy_write(phydev, 0x0, 0x2100) before phy_connect_direct in geth_phy_init at drivers/net/ethernet/allwinner/sunxi-gmac.c.
The above are the common network card design questions during A40i development process. Some of them are caused by configuration problems when referring to schematic diagram. Some are by abnormal chip output signals.
The following is common troubleshooting methods for network card software. It may help you have a debugging idea when debugging phy, and tools mentioned can help you quickly locate and solve problems.
How to troubleshoot
- (1) Check whether menuconfig and dts Ethernet configuration are open;
- (2) Check whether phy-mode configuration matches the physical interface between PHY and GMAC, such as rgmii, rmii.
- (3) Check whether GPIO configuration is correct, such as IO multiplexing, driving capability.
- (4) Use phytool to read phy ID to verify whether MDIO is correct.
As shown below, if phy ID of JL11x1 can be read normally, it means MDIO communication is normal.
Use phytool to read phy status register to view phy chip status. Taking JL11x1 as an example, if read value of 0x01 status register is 0x786d, it means link is successful and works normally.
The above are network card software questions analysis and troubleshooting methods of A40i dual network port solution. If encounter other network card questions, you can consult Forlinx sales engineer online.