Article count:204 Read by:596416

Featured Content
Account Entry

Ethernet driver development based on DWC_ether_qos-data flow verification process

Latest update time:2023-08-31
    Reads:

I. Introduction

The writing and debugging of Ethernet drivers are data flow-oriented. We can verify the data flow in a layer-by-layer manner, that is, first verify the MAC layer, then verify the PHY layer, and then verify the specific device such as PC sending and receiving data.

As follows

2. MAC layer loopback

The MAC layer loopback can confirm whether the MAC 's DMA and PHY interfaces are working properly .

The MAC layer loopback is the internal loopback of the MAC 's MII interface. It does not reach the external PHY , but it also verifies the MAC 's PHY interface.

See Manual 16 Using the Loopback Mode

To enable MAC loopback, the LM bit of the configuration register MAC_Configuration needs to be 1

There are the following points to note :

1. Only full-duplex mode can be used

2. MAC loopback also requires RXC clock. Normally, RXC clock comes from PHY , so either use PHY to work normally, or use other methods to provide RXC clock. In many cases, MAC loopback is not working because RXC or TXC is not working, so use an oscilloscope to confirm these two signals first.

For RTL8211F, you can check whether RXC is output through the following registers

At the same time, confirm whether the following registers are LPI stopped RXC

It is best to configure the following registers to 0 by default , that is, do not stop RXC during LPI

Another thing to note is that in my actual test, the computer must be connected to the Internet cable, and the bit 2 of the BMSR in the Link OK state must be 1 for the MAC loopback to work. Otherwise, the MAC loopback will not work.

3. Don’t loop back large packets

3. PHY layer loopback

Configure bit 14 of PHY register 0 to 1

4. ARP test data transmission and reception

Send an ARP request and the computer will automatically return an ARP response to test the loop.

The format of the ARP request packet is as follows

DA

6 -byte destination MAC address, set to all FF broadcast


S

6- byte source MAC address


Type

2- byte Type 0x0806


HWType

2 bytes 0x0001


ProtocolType

2 bytes 0x0800


HWSize

1 byte 0x06


ProtocolSize

1 byte 0x04


Opcode

2 bytes 0x0001



6 -byte sender MAC address



4 -byte sender IP address



6 -byte destination MAC address, unknown so all 0s



4 -byte destination IP address



18 bytes filled with 0 , making the packet length (DA to FCS) 64 bytes


The ARP response packet has a different Opcode from the request packet, and the source and destination of the MAC and IP are reversed.

DA

6- byte destination MAC address


S

6- byte source MAC address


Type

2- byte Type 0x0806


HWType

2 bytes 0x0001


ProtocolType

2 bytes 0x0800


HWSize

1 byte 0x06


ProtocolSize

1 byte 0x04


Opcode

2 bytes 0x0002



6 -byte sender MAC address



4 -byte sender IP address



6 -byte destination MAC address, unknown so all 0s



4 -byte destination IP address



18 bytes filled with 0 , making the packet length (DA to FCS) 64 bytes


1. Note the minimum frame length requirement of 64 bytes

The CPC of TDES3 is set to 00 for automatic filling.

2. Use wireshark to capture the packet and confirm

5. Conclusion

1. If the MAC layer loopback is unavailable, confirm whether RXC and TXC have clocks, confirm the receiving and sending status of DMA_Debug_Status0 and the related registers of the descriptor ( the debugging of receiving and sending will be discussed in detail later ) .

2. If the PHY layer loopback fails, confirm whether the PHY is in the LINK Ok state and monitor the MII interface with a logic analyzer .

3. If the ARP test fails, confirm whether the sent packet is filled to 64 bytes; confirm the network cable, hardware analyzer packet capture, etc.



Latest articles about

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号