0 工具准备
1.野火 stm32f407霸天虎开发板
2.LAN8720数据手册
3.STM32F4xx中文参考手册
1 PHY寄存器
前面介绍到,站管理接口(SMI)允许应用程序通过2线时钟和数据线访问任意PHY寄存器,同时该接口支持访问最多32个PHY,也就是说PHY地址共有5位。
应用程序可以从32个PHY中选择一个PHY,然后从任意PHY包含的32个寄存器中选择一个寄存器,发送控制数据或接收状态信息。任意给定时间内只能对一个PHY的一个寄存器进行寻址。
IEEE802.3定义了地址0-15这16个寄存器的功能,所有的PHY地址0-15寄存器bit的定义应当符合该标准,地址16-31的寄存器由芯片厂商自行定义。

对于LAN8720来说,PHY一共包含14个寄存器,定义如下:

1.1 IEEE802.3标准寄存器
1.1.1 Basic Control Register(地址0基本控制寄存器)

这里用的最多的就是bit15,软件复位。
1.1.2 Basic Control Register(地址1基本状态寄存器)

bit2非常有用,用来判断网卡是否建立了有效连接。
1.1.3 PHY Identifier 1 Register(地址2 PHY ID 1寄存器)

默认值为0x0007。
1.1.4 PHY Identifier 2 Register(地址3 PHY ID 2寄存器)

可以和PHY ID 1寄存器组合用来区分PHY型号。
1.1.5 Auto Negotiation Advertisement Register(地址4自动协商的能力通告寄存器)

1.1.6 Auto Negotiation Link Partner Ability Register(地址5自协商对端能力寄存器)

1.1.7 Auto Negotiation Expansion Register(地址6自动协商扩展寄存器)

1.2 LAN8720自定义寄存器
1.2.1 Mode Control/Status Register(地址17模式控制/状态寄存器)

1.2.2 Special Modes Register(地址18特殊模式寄存器)

1.2.3 Symbol Error Counter Register(地址26错误标志计数器寄存器)

1.2.4 Special Control/Status Indications Register(地址27特殊控制/状态指示寄存器)

1.2.5 Interrupt Source Flag Register(地址29中断来源标志寄存器)

1.2.6 Interrupt Mask Register(地址30中断屏蔽寄存器)

1.2.7 PHY Special Control/Status Register(地址31PHY特殊控制/状态寄存器)

2 总结
(1)LAN8720一共有14个寄存器,包括7个IEE802.3标准寄存器和7个厂家自定义寄存器。
(2)中断输出引脚通常都被用于50MHz时钟输出,因此不必关注有关中断的寄存器。