先說硬件配置:CH32V307VCT6通過RGMII與國產某千兆PHY連接;CH32V307的PB1管腳(RGMII_125IN)接的是外部獨立的125M TCXO;CH32V307的時鐘來自外部8M晶振;千兆PHY的時鐘來自外部獨立的25M晶振,與CH32V307無關。
軟件部分:直接使用官網上提供的demo例程(ETH_RGMII),僅僅把發(fā)送部分的打印信息去掉了,見下圖:
另外,為了便于測試,我把demo例程里的ARP包的數(shù)據(jù)改成跟我計算機相匹配。
測試結果:PHY正常自協(xié)商到千兆。從抓包數(shù)據(jù)來看,數(shù)據(jù)的發(fā)送正常,每0.8秒左右計算機就會收到CH32V307發(fā)過來的ARP報文,同時計算機及時回復了報文,見下圖:
但是調試打印結果提示經常收不到計算機回復的報文,時而能收到時而收不到,見下面打印信息:
receive counter:6.
read_length:60
Received@0x200002a0
Status:0x80408302
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
Error:recv error frame,status:0x00408302.
Error:recv error frame,status:0x00408302.
receive counter:7.
read_length:60
Received@0x20001a60
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:8.
read_length:60
Received@0x20002050
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:9.
read_length:60
Received@0x200002a0
Status:0x80408302
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
receive counter:10.
read_length:60
Received@0x20000e80
Status:0x80408302
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:11.
read_length:60
Received@0x20001470
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:12.
read_length:60
Received@0x20001a60
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:13.
read_length:60
Received@0x20002050
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
receive counter:14.
read_length:60
Received@0x20000890
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
receive counter:15.
read_length:60
Received@0x20000e80
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
receive counter:16.
read_length:60
Received@0x20001a60
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
receive counter:17.
read_length:60
Received@0x200002a0
Status:0x80400300
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
receive counter:18.
read_length:60
Received@0x20000e80
Status:0x80408302
84 c2 e4 01 02 03?
e8 6a 64 53 29 a0?
08 06 00 01 08 00 06 04 00 02 END!
Error:recv error frame,status:0x00408302.
這種情況有可能是什么造成的?硬件問題還是軟件以太網驅動問題?