updade:
1.修改上下行网口速率为自协商 2.修改下行网口重置后IP为10.21.54.8,端口为502 3.产线烧录版
This commit is contained in:
+38
-4
@@ -37,12 +37,12 @@ void bsp_W5500_Socket_Set(bsp_W5500_Class_t *pW5500_Class);
|
||||
static u8 last_link_status = 0; // 保存上一次链路状态
|
||||
bsp_W5500_t W5500 =
|
||||
{
|
||||
.Gateway_IP = {192,168,1,1},
|
||||
.Sub_Mask = {255,255,255,0},
|
||||
.Gateway_IP = {10,21,54,1},
|
||||
.Sub_Mask = {255,255,252,0},
|
||||
.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01},
|
||||
|
||||
//.IP_Addr = {169,254,107,101},
|
||||
.IP_Addr = {192,168,1,101},
|
||||
.IP_Addr = {10,21,54,2},
|
||||
.Monitor_task = network_monitor_task,
|
||||
.Interrupt_Process = bsp_W5500_Interrupt_Process,
|
||||
|
||||
@@ -53,7 +53,7 @@ bsp_W5500_t W5500 =
|
||||
.W5500_Class[0] =
|
||||
{
|
||||
.SocketPort = 0, /*使用端口0*/
|
||||
.ConfigData.Port = {0x13,0x88},
|
||||
.ConfigData.Port = {0x13,0x8A},
|
||||
// .ConfigData.DIP = {192,168,1,32},
|
||||
// .ConfigData.DPort = {0x03,0x09},
|
||||
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
|
||||
@@ -463,6 +463,39 @@ void W5500_Hardware_Reset(void)
|
||||
// while((Read_W5500_1Byte(PHYCFGR)&LINK)==0);//等待以太网连接完成
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* 函数名 : W5500_PHY_Set_100M_FullDuplex
|
||||
* 描述 : 软件强制 W5500 速率
|
||||
* 输入 : 无
|
||||
* 输出 : 无
|
||||
* 返回值 : 无
|
||||
* 说明 :
|
||||
*******************************************************************************/
|
||||
static void W5500_PHY_Set_100M_FullDuplex(void)
|
||||
{
|
||||
u8 cfg;
|
||||
u8 phy,a;
|
||||
Wdg.Feed();
|
||||
/* OPMD=1 软件配置,OPMDC=111 →,自动协商 */
|
||||
cfg = OPMODE | OPMDC_ALL_AN; /* 0x38 */
|
||||
|
||||
/* 步骤1:写 RST=1 + 目标配置,让配置生效 */
|
||||
Write_W5500_1Byte(PHYCFGR, cfg | RST_PHY); /* 0xD8 */
|
||||
HAL_Delay(10);
|
||||
|
||||
/* 步骤2:写 RST=0 触发 PHY 复位 */
|
||||
Write_W5500_1Byte(PHYCFGR, cfg); /* 0x58 */
|
||||
HAL_Delay(10);
|
||||
|
||||
/* 步骤3:写 RST=1 结束复位,PHY 按新配置启动 */
|
||||
Write_W5500_1Byte(PHYCFGR, cfg | RST_PHY); /* 0xD8 */
|
||||
HAL_Delay(1000); /* 等链路重建,至少 1 秒 */
|
||||
|
||||
/* 读回验证 */
|
||||
phy = Read_W5500_1Byte(PHYCFGR);
|
||||
a=phy;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* 函数名 : W5500_Init
|
||||
* 描述 : 初始化W5500寄存器函数
|
||||
@@ -808,6 +841,7 @@ static void bsp_W5500_Init()
|
||||
Wdg.Feed();
|
||||
W5500_Hardware_Reset(); /*硬件复位W5500*/
|
||||
W5500_Init(); /*初始化W5500寄存器函数*/
|
||||
W5500_PHY_Set_100M_FullDuplex();/*设置网口速率*/
|
||||
Detect_Gateway(); /*检查网关服务器*/
|
||||
|
||||
for(i=0;i<BSP_W5500_PORT_NUM;i++)
|
||||
|
||||
Reference in New Issue
Block a user