备份 -热拔插

This commit is contained in:
王绪洁 2025-06-30 14:30:16 +08:00
parent fbe63f0ef8
commit 2f81e27eb0
5 changed files with 5222 additions and 5206 deletions

View File

@ -111,7 +111,8 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp
* @param None
* @retval None
*/
void MX_FREERTOS_Init(void) {
void MX_FREERTOS_Init(void)
{
/* USER CODE BEGIN Init */
/* USER CODE END Init */
@ -160,7 +161,6 @@ void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
}
/* USER CODE BEGIN Header_start_tcp_task */
@ -181,6 +181,10 @@ void start_tcp_task(void const * argument)
for (;;)
{
uint32_t phyreg = 0;
if (tcp_echo_flags_hart1 == 1 || tcp_echo_flags_hart2 == 1 || tcp_echo_flags_ble1 == 1 ||
tcp_echo_flags_ble2 == 1 || tcp_echo_flags_control == 1)
{
HAL_ETH_ReadPHYRegister(&heth, 0x00, PHY_BSR, &phyreg);
if (((phyreg >> 2) & 0x1) != 0x1)
{
@ -222,12 +226,7 @@ void start_tcp_task(void const * argument)
/* When the netif is fully configured this function must be called */
netif_set_link_up(&gnetif);
netif_set_up(&gnetif); // 热插拔上线时调用
// if (tcp_echo_flags_ble1 == 2)
// {
// tcp_echo_init(); // 热插拔上线时调用
// // uart_lcd_draw_ipaddr(); // 初始化显示IP地址信息
// tcp_echo_flags_ble1 = 0;
// }
}
}
vTaskDelay(1000);
@ -271,7 +270,7 @@ void start_dac_task(void const * argument)
/* Infinite loop */
for (;;)
{
osThreadSuspend(adc_taskHandle); // 暂停ADC任务防止DAC采集时产生干<E7949F><EFBFBD>?????????,因为ADC和DAC采用的是同一路SPI但是时序不<EFBFBD><EFBFBD>?????????
osThreadSuspend(adc_taskHandle); // 暂停ADC任务防止DAC采集时产生干<E7949F>?????????,因为ADC和DAC采用的是同一路SPI但是时序不<E5BA8F>?????????
dac161s997_output(DAC161S997_1, current_buff[0]);
dac161s997_output(DAC161S997_2, current_buff[1]);
osThreadResume(adc_taskHandle);
@ -294,7 +293,7 @@ void start_adc_task(void const * argument)
/* Infinite loop */
for (;;)
{
osThreadSuspend(dac_taskHandle); // 暂停DAC任务防止ADC采集时产生干<E7949F><EFBFBD>?????????,因为ADC和DAC采用的是同一路SPI但是时序不<EFBFBD><EFBFBD>?????????
osThreadSuspend(dac_taskHandle); // 暂停DAC任务防止ADC采集时产生干<E7949F>?????????,因为ADC和DAC采用的是同一路SPI但是时序不<E5BA8F>?????????
uint8_t ch = 0;
for (ch = STOP_NC_ADC; ch < AD7124_CHANNEL_EN_MAX; ch++)
{

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion>
@ -45,7 +45,7 @@
<PageWidth>79</PageWidth>
<PageLength>66</PageLength>
<TabStop>8</TabStop>
<ListingPath />
<ListingPath></ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
@ -104,16 +104,16 @@
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>6</nTsel>
<sDll />
<sDllPa />
<sDlgDll />
<sDlgPa />
<sIfile />
<tDll />
<tDllPa />
<tDlgDll />
<tDlgPa />
<tIfile />
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
@ -130,7 +130,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name />
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -162,7 +162,7 @@
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</Filename>
<ExecCommand />
<ExecCommand></ExecCommand>
<Expression>\\semi_finished_product_testing\../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c\2413</Expression>
</Bp>
</Breakpoint>
@ -280,19 +280,19 @@
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable />
<LintConfigFile />
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName />
<pszMrule />
<pSingCmds />
<pMultCmds />
<pMisraNamep />
<pszMrulep />
<pSingCmdsp />
<pMultCmdsp />
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<DebugDescription>
<Enable>0</Enable>
<EnableFlashSeq>0</EnableFlashSeq>

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="project_projx.xsd">
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>semi-finished_product_testing</TargetName>
@ -16,28 +19,28 @@
<PackID>Keil.STM32F4xx_DFP.2.12.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 />
<StartupFile />
<FlashDriverDll />
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile />
<MemoryEnv />
<Cmp />
<Asm />
<Linker />
<OHString />
<InfinionOptionDll />
<SLE66CMisc />
<SLE66AMisc />
<SLE66LinkerMisc />
<RegisterFile></RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:STM32F407VGTx$CMSIS\SVD\STM32F40x.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath />
<IncludePath />
<LibPath />
<RegisterFilePath />
<DBRegisterFilePath />
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
@ -52,15 +55,15 @@
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>0</BrowseInformation>
<ListingPath />
<ListingPath></ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name />
<UserProg2Name />
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
@ -69,8 +72,8 @@
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name />
<UserProg2Name />
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
@ -79,15 +82,15 @@
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name />
<UserProg2Name />
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString />
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
@ -101,8 +104,8 @@
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument />
<IncludeLibraryModules />
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>0</ComprImg>
</CommonProperty>
<DllOption>
@ -136,10 +139,10 @@
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2V8M.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4 />
<pFcarmOut />
<pFcarmGrp />
<pFcArmRoot />
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
@ -172,7 +175,7 @@
<RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName />
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
@ -306,7 +309,7 @@
<Size>0x4000</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector />
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
@ -333,9 +336,9 @@
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls />
<MiscControls></MiscControls>
<Define>USE_HAL_DRIVER,STM32F407xx</Define>
<Undefine />
<Undefine></Undefine>
<IncludePath>../Core/Inc;../LWIP/App;../LWIP/Target;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;../User/application/inc;../User/board/inc;../User/driver;../User/system</IncludePath>
</VariousControls>
</Cads>
@ -351,9 +354,9 @@
<useXO>0</useXO>
<ClangAsOpt>1</ClangAsOpt>
<VariousControls>
<MiscControls />
<Define />
<Undefine />
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>../Core/Inc</IncludePath>
</VariousControls>
</Aads>
@ -364,15 +367,15 @@
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange />
<DataAddressRange />
<pXoBase />
<ScatterFile />
<IncludeLibs />
<IncludeLibsPath />
<Misc />
<LinkerInputFile />
<DisabledWarnings />
<TextAddressRange></TextAddressRange>
<DataAddressRange></DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile></ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
@ -1138,6 +1141,7 @@
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
@ -1150,6 +1154,7 @@
</components>
<files/>
</RTE>
<LayerInfo>
<Layers>
<Layer>
@ -1158,5 +1163,5 @@
</Layer>
</Layers>
</LayerInfo>
</Project>
</Project>

View File

@ -58,7 +58,6 @@ 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);
tcp_echo_flags_hart1 = 0;
return tcp_close(tpcb);
}
@ -133,7 +132,6 @@ 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);
tcp_echo_flags_ble2 = 0;
return tcp_close(tpcb);
}
@ -234,7 +232,6 @@ 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);
tcp_echo_flags_control = 0;
return tcp_close(tpcb);
}
@ -347,12 +344,10 @@ void tcp_echo_init(void)
void user_send_data_hart1(uint8_t *data, uint16_t len)
{
tcp_write(server_pcb_hart1, data, len, 1);
}
void user_send_data_hart2(uint8_t *data, uint16_t len)
{
tcp_write(server_pcb_hart2, data, len, 1);
}
#if (BLE2_USART6 == 1)
@ -364,7 +359,6 @@ void user_send_data_ble1(uint8_t *data, uint16_t len)
#endif
void user_send_data_ble2(uint8_t *data, uint16_t len)
{
tcp_write(server_pcb_ble2, data, len, 1);
}
@ -373,6 +367,16 @@ void user_send_data_control(uint8_t *data, uint16_t len)
tcp_write(server_pcb_control, data, len, 1);
}
/**
* @brief UART TCP
*
* UART TCP
*
* uart_echo_flags_hart1 1 user_send_data_hart1 hart1_uart5 TCP
* uart_echo_flags_hart2 1 user_send_data_hart2 hart2_uart2 TCP
* BLE2_USART6 uart_echo_flags_ble1 1 user_send_data_ble1 ble1_uart6 TCP
* uart_echo_flags_ble2 1 user_send_data_ble2 ble2_uart3 TCP
*/
void uart_forwarding_tcp(void)
{
if (uart_echo_flags_hart1 == 1)