PHY芯片学习笔记1

 PHY芯片简介

从硬件上来说,一般的PHY芯片为模数混合电路,负责接收电、光这类模拟信号,经过解调和A/D转换后通过MII/RMII接口将信号交给MAC内核处理。

PHY地址的设置

SMI站管理接口通过PHY地址访问指定的PHY芯片,简称:PHY芯片的标识。

DP83848的默认地址ADDR是0x01。

外部提供50MHz时钟连接到PHY芯片34号引脚以及RMII_REF_CLK

PHY寄存器简介

有32个寄存器,每一个寄存器都是16位

寄存器:

1、相同的寄存器:根据IEEE802.3标准定义了0~15寄存器(重点BCR和BSR寄存器)

2、自由定义的寄存器:16~31寄存器是由芯片制造商自由定义(制造商定义的)

前16个寄存器用于配置PHY,而后16个寄存器是使用判断网络参数的(双工、网速)

因为前16个寄存器都是类似的,所以ST已经把主要框架搭建好了,用户只负责设置双工和网速参数即可

 

 特殊功能寄存器

通过确认网速及双工模式来设置BCR寄存器的bit8和bit13

#define PHY_SR ((uint16_t)0x0010) 			/*!< PHY status register Offset */ 
#define PHY_SPEED_STATUS ((uint16_t)0x0002) 	/*!< PHY Speed mask */ 
#define PHY_DUPLEX_STATUS ((uint16_t)0x0004)	/*!< PHY Duplex mask */
//L8720A

每一个PHY的特殊功能寄存器都不一样,需要根据相关的手册来确定

DP83848 设置

#define PHY_BCR                          0          /*!< Transceiver Basic Control Register */
#define PHY_BSR                          1          /*!< Transceiver Basic Status Register */

#define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20)
#define IS_ETH_PHY_REG(REG) (((REG) == PHY_BCR) || \
                             ((REG) == PHY_BSR) || \
                             ((REG) == PHY_SR))
/**
  * @}
  */

/** @defgroup PHY_basic_Control_register 
  * @{
  */ 
#define PHY_Reset                       ((uint16_t)0x8000)      /*!< PHY Reset */
#define PHY_Loopback                    ((uint16_t)0x4000)      /*!< Select loop-back mode */
#define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100)      /*!< Set the full-duplex mode at 100 Mb/s */
#define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000)      /*!< Set the half-duplex mode at 100 Mb/s */
#define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100)      /*!< Set the full-duplex mode at 10 Mb/s */
#define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000)      /*!< Set the half-duplex mode at 10 Mb/s */
#define PHY_AutoNegotiation             ((uint16_t)0x1000)      /*!< Enable auto-negotiation function */
#define PHY_Restart_AutoNegotiation     ((uint16_t)0x0200)      /*!< Restart auto-negotiation function */
#define PHY_Powerdown                   ((uint16_t)0x0800)      /*!< Select the power down mode */
#define PHY_Isolate                     ((uint16_t)0x0400)      /*!< Isolate PHY from MII */
/**
  * @}
  */

/** @defgroup PHY_basic_status_register 
  * @{
  */ 
#define PHY_AutoNego_Complete           ((uint16_t)0x0020)      /*!< Auto-Negotiation process completed */
#define PHY_Linked_Status               ((uint16_t)0x0004)      /*!< Valid link established */
#define PHY_Jabber_detection            ((uint16_t)0x0002)      /*!< Jabber condition detected */

 

对应代码 
#define PHY_Linked_Status               ((uint16_t)0x0004)      /*!< Valid link established */

 

 

 

 

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值