MAC地址BUG修复

This commit is contained in:
wangxujie-laptop 2025-04-15 16:07:15 +08:00
parent 7434473b2f
commit 2fd1f87085
5 changed files with 5457 additions and 5437 deletions

View File

@ -72,6 +72,15 @@ void MX_LWIP_Init(void)
GATEWAY_ADDRESS[3] = 29;
/* USER CODE BEGIN IP_ADDRESSES */
uint8_t ip_address_flash[4] = {0,0,0,0};
flash_read_data(FLASH_USER_START_ADDR, ip_address_flash, 4);
if (ip_address_flash[0] == 192)
{
IP_ADDRESS[0] = ip_address_flash[0];
IP_ADDRESS[1] = ip_address_flash[1];
IP_ADDRESS[2] = ip_address_flash[2];
IP_ADDRESS[3] = ip_address_flash[3];
}
/* USER CODE END IP_ADDRESSES */
/* Initilialize the LwIP stack with RTOS */
@ -109,12 +118,7 @@ void MX_LWIP_Init(void)
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
/* USER CODE BEGIN 3 */
flash_read_data(FLASH_USER_START_ADDR, IP_ADDRESS, 4);
if (IP_ADDRESS[0] == 192)
{
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
gnetif.ip_addr = ipaddr;
}
/* USER CODE END 3 */
}

View File

@ -145,7 +145,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U090F00028316303030303032 -O2254 -SF500 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO31 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
<Name>-U090F00028316303030303032 -O2254 -SF500 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint>
@ -154,20 +154,36 @@
<Type>0</Type>
<LineNumber>2413</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<Address>134234476</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
<Expression>\\semi_finished_product_testing\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\2413</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>77</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134238496</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../LWIP/App/lwip.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\semi_finished_product_testing\../LWIP/App/lwip.c\77</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>224</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
@ -177,12 +193,12 @@
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>../Core/Src/main.c</Filename>
<Filename>startup_stm32f407xx.s</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>2</Number>
<Number>3</Number>
<Type>0</Type>
<LineNumber>226</LineNumber>
<EnabledFlag>1</EnabledFlag>
@ -193,7 +209,7 @@
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>../Core/Src/main.c</Filename>
<Filename>startup_stm32f407xx.s</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
@ -259,6 +275,16 @@
<WinNumber>1</WinNumber>
<ItemText>huart5</ItemText>
</Ww>
<Ww>
<count>12</count>
<WinNumber>1</WinNumber>
<ItemText>IP_ADDRESS</ItemText>
</Ww>
<Ww>
<count>13</count>
<WinNumber>1</WinNumber>
<ItemText>ip_address_flash,0x0A</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
@ -530,7 +556,7 @@
<Group>
<GroupName>Drivers/STM32F4xx_HAL_Driver</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -902,7 +928,7 @@
<Group>
<GroupName>Middlewares/LwIP</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>

View File

@ -16,8 +16,8 @@
<TargetCommonOption>
<Device>STM32F407VGTx</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F4xx_DFP.2.12.0</PackID>
<PackURL>http://www.keil.com/pack</PackURL>
<PackID>Keil.STM32F4xx_DFP.2.16.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x2001BFFF) IRAM2(0x2001C000-0x2001FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") TZ</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
@ -186,6 +186,7 @@
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>

View File

@ -53,7 +53,7 @@ static err_t tcpecho_recv_hart1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
}
else if (err == ERR_OK) // 检测到对方主动关闭连接时也会调用recv函数此时p为空
{
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
tcp_echo_flags_hart1 = 0;
return tcp_close(tpcb);
}
@ -79,7 +79,7 @@ static err_t tcpecho_recv_hart2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
}
else if (err == ERR_OK) // 检测到对方主动关闭连接时也会调用recv函数此时p为空
{
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
tcp_echo_flags_hart2 = 0;
return tcp_close(tpcb);
}
@ -128,7 +128,7 @@ static err_t tcpecho_recv_ble2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
}
else if (err == ERR_OK) // 检测到对方主动关闭连接时也会调用recv函数此时p为空
{
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
tcp_echo_flags_ble2 = 0;
return tcp_close(tpcb);
}
@ -229,7 +229,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
}
else if (err == ERR_OK) // 检测到对方主动关闭连接时也会调用recv函数此时p为空
{
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
tcp_echo_flags_control = 0;
return tcp_close(tpcb);
}