@@ -58,6 +58,7 @@ static ETH_HandleTypeDef EthHandle;
5858static ETH_TxPacketConfig TxConfig ;
5959static struct rt_stm32_eth stm32_eth_device ;
6060static uint8_t PHY_ADDR = 0x1F ;
61+ static rt_uint32_t reset_pin = 0 ;
6162
6263#if defined ( __ICCARM__ ) /*!< IAR Compiler */
6364#pragma location=0x30040000
@@ -106,9 +107,9 @@ static void dump_hex(const rt_uint8_t *ptr, rt_size_t buflen)
106107
107108static void phy_reset (void )
108109{
109- rt_pin_write (ETH_RESET_PIN , PIN_LOW );
110+ rt_pin_write (reset_pin , PIN_LOW );
110111 rt_thread_mdelay (50 );
111- rt_pin_write (ETH_RESET_PIN , PIN_HIGH );
112+ rt_pin_write (reset_pin , PIN_HIGH );
112113}
113114
114115
@@ -499,9 +500,10 @@ static void phy_monitor_thread_entry(void *parameter)
499500static int rt_hw_stm32_eth_init (void )
500501{
501502 rt_err_t state = RT_EOK ;
503+ reset_pin = rt_pin_get (ETH_RESET_PIN );
502504
503- rt_pin_mode (ETH_RESET_PIN , PIN_MODE_OUTPUT );
504- rt_pin_write (ETH_RESET_PIN , PIN_HIGH );
505+ rt_pin_mode (reset_pin , PIN_MODE_OUTPUT );
506+ rt_pin_write (reset_pin , PIN_HIGH );
505507
506508 stm32_eth_device .ETH_Speed = ETH_SPEED_100M ;
507509 stm32_eth_device .ETH_Mode = ETH_FULLDUPLEX_MODE ;
0 commit comments