From 918c03cd4538f34a9a17ec0c08f1d6af8e2ca072 Mon Sep 17 00:00:00 2001 From: murmur Date: Sun, 15 Dec 2024 10:27:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=8B=E5=AD=90=E6=AD=A3=E5=B8=B8=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Src/gpio.c | 2 +- Core/Src/main.c | 6 +++++- Core/Src/w5500_init.c | 2 +- f1CTL.ioc | 8 +++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index aff7e62..c13b02f 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -60,7 +60,7 @@ void MX_GPIO_Init(void) HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOD, NET_RST_Pin|NET_CS_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOD, NET_RST_Pin|NET_CS_Pin, GPIO_PIN_SET); /*Configure GPIO pins : PE2 PE3 PE4 PE5 PE6 PE7 PE8 PE9 diff --git a/Core/Src/main.c b/Core/Src/main.c index a5ced0f..e411141 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -96,7 +96,11 @@ int main(void) MX_SPI2_Init(); /* USER CODE BEGIN 2 */ if(W5500_Init() != 0) { - Error_Handler(); + while(1) + { + HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); + HAL_Delay(100); + } } // 执行HTTP测试 diff --git a/Core/Src/w5500_init.c b/Core/Src/w5500_init.c index 36810d7..7376f97 100644 --- a/Core/Src/w5500_init.c +++ b/Core/Src/w5500_init.c @@ -5,7 +5,7 @@ wiz_NetInfo gWIZNETINFO = { .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC 地址 .ip = {169, 254, 1, 11}, // IP 地址 .sn = {255, 255, 255, 0}, // 子网掩码 - .gw = {192, 168, 1, 1}, // 网关地址 + .gw = {169, 254, 1, 1}, // 网关地址 .dns = {8, 8, 8, 8}, // DNS 服务器 .dhcp = NETINFO_STATIC // 静态IP模式 }; diff --git a/f1CTL.ioc b/f1CTL.ioc index 7120039..08f2ddd 100644 --- a/f1CTL.ioc +++ b/f1CTL.ioc @@ -102,17 +102,19 @@ PB14.Mode=Full_Duplex_Master PB14.Signal=SPI2_MISO PB15.Mode=Full_Duplex_Master PB15.Signal=SPI2_MOSI -PD10.GPIOParameters=GPIO_Label +PD10.GPIOParameters=PinState,GPIO_Label PD10.GPIO_Label=NET_CS PD10.Locked=true +PD10.PinState=GPIO_PIN_SET PD10.Signal=GPIO_Output PD8.GPIOParameters=GPIO_Label PD8.GPIO_Label=NET_INT PD8.Locked=true PD8.Signal=GPIO_Input -PD9.GPIOParameters=GPIO_Label +PD9.GPIOParameters=PinState,GPIO_Label PD9.GPIO_Label=NET_RST PD9.Locked=true +PD9.PinState=GPIO_PIN_SET PD9.Signal=GPIO_Output PE15.GPIOParameters=GPIO_Label PE15.GPIO_Label=LED @@ -149,7 +151,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_USART2_UART_Init-USART2-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_USART2_UART_Init-USART2-false-HAL-true,6-MX_SPI2_Init-SPI2-false-HAL-true RCC.ADCFreqValue=36000000 RCC.AHBFreq_Value=72000000 RCC.APB1CLKDivider=RCC_HCLK_DIV2