stm32mp2 RMII phy调试总结

stm32mp2  RMII phy调试总结
phy有两种提供clk的方式
1、mac直接提供50M clk给phy。
此时的pin连接 ETH1_CLK(stm32mp2端) -->   RXC(rtl8201f端)

2、晶振提供25M clk给phy,phy在输出给50M给MAC
此时的pin连接 TXC(rtl8201f端)--->ETH1_RMII_REF_CLK(stm32mp2端)

3、是否需要进行reset,延时多少
reset-gpios =  <&gpiob 6 GPIO_ACTIVE_LOW>;
reset-assert-us = <10000>;
reset-deassert-us = <80000>;
            
4、需要配置mac端clk 输入还是输出配置
st,ext-phyclk;

5、phyid和具体使用的phy
此处001C.c816为phy的id值,查手册得知
phy0_eth1: ethernet-phy@0 {
    compatible = "ethernet-phy-id001C.c816",
              "ethernet-phy-ieee802.3-c22";
    reset-gpios =  <&gpiob 6 GPIO_ACTIVE_LOW>;
    reset-assert-us = <10000>;
    reset-deassert-us = <100000>;
    reg = <0>;   
};

### STM32 RMII HAL Library Ethernet Communication Example and Documentation #### Overview of RMII Interface on STM32 with HAL Library The Reduced Media Independent Interface (RMII) is a simplified version of the MII interface, designed to reduce pin count while maintaining performance suitable for most applications requiring Ethernet connectivity. The STM32 microcontroller series supports this interface through its hardware capabilities combined with software support via the Hardware Abstraction Layer (HAL) library[^1]. #### Configuration Using STM32CubeMX For configuring an STM32 project that uses the RMII interface along with the LAN8720 PHY chip, one can utilize STM32CubeMX as it simplifies setup by generating initialization code based on user selections. This tool ensures proper configuration settings are applied according to selected parameters such as clock sources or external components like oscillators needed for RMII operation. ```c // Generated by STM32CubeMX void SystemClock_Config(void){ // Clock configurations... } static void MX_ETH_Init(void){ heth.Instance = ETH; heth.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE; heth.Init.PhyAddress = 0x00; heth.Init.MACAddr[0] = 0x00; heth.Init.MACAddr[1] = 0x80; heth.Init.MACAddr[2] = 0xE1; heth.Init.MACAddr[3] = 0x00; heth.Init.MACAddr[4] = 0x00; heth.Init.MACAddr[5] = 0x00; } ``` #### Implementation Details Based on Provided Source Code Repository A practical implementation example comes from a repository where developers have successfully implemented stable network connections using the RMII interface between STM32F407VE and LAN8720 chips. Key aspects include ensuring correct wiring diagrams connecting both devices properly, setting up appropriate clocks within the system, initializing peripherals correctly including MAC address assignment, enabling auto-negotiation features supported by chosen PHY device among others[^2]. #### Important Considerations Regarding Clocking Mechanism When implementing RMII interfaces specifically targeting certain models like stm32mp2 alongside specific PHYs such as rtl8201f, attention should be paid towards how reference clocks are provided since there exist two primary methods: either having the MAC supply a 50 MHz signal directly to the PHY over dedicated pins (`ETH1_CLK` -> `RXC`) or alternatively relying upon external crystal/clock generators depending on design requirements[^4]. --related questions-- 1. How does SMI interact during the initialization phase when establishing communication links? 2. What steps need special care when physically connecting STM32 boards supporting RMII mode with various types of Ethernet PHY modules? 3. Can you provide more details about potential issues encountered while debugging RMII-based projects involving different STM32 families? 4. Are there any differences in handling interrupts related to Ethernet operations across multiple versions of the HAL libraries?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值