This commit is contained in:
王绪洁 2025-03-31 17:32:50 +08:00
parent 43bafaf16a
commit aadb90b07d
13 changed files with 6586 additions and 6383 deletions

View File

@ -1,7 +1,7 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f4xx_hal_conf_template.h
* @file stm32f4xx_hal_conf.h
* @author MCD Application Team
* @brief HAL configuration template file.
* This file should be copied to the application folder and renamed
@ -25,7 +25,8 @@
#define __STM32F4xx_HAL_CONF_H
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
/* Exported types ------------------------------------------------------------*/
@ -117,8 +118,8 @@
*/
#if !defined(LSI_VALUE)
#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz*/
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
The real value may vary depending on the variations
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz \
The real value may vary depending on the variations \
in voltage and temperature.*/
/**
* @brief External Low Speed oscillator (LSE) value.

View File

@ -71,6 +71,7 @@ void UART4_IRQHandler(void);
void UART5_IRQHandler(void);
void DMA2_Stream2_IRQHandler(void);
void ETH_IRQHandler(void);
void ETH_WKUP_IRQHandler(void);
void DMA2_Stream7_IRQHandler(void);
/* USER CODE BEGIN EFP */

View File

@ -36,6 +36,7 @@
#include "uart_lcd.h"
#include "user_gpio.h"
#include "linear_encoder.h"
#include "lan8742.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -67,6 +68,16 @@ osThreadId ec11_taskHandle;
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */
extern float current_buff[2];
extern struct netif gnetif;
extern ETH_HandleTypeDef heth;
extern struct tcp_pcb *server_pcb_hart1;
extern struct tcp_pcb *server_pcb_hart2;
extern struct tcp_pcb *server_pcb_ble1;
extern struct tcp_pcb *server_pcb_ble2;
extern struct tcp_pcb *server_pcb_control;
extern void tcp_abort(struct tcp_pcb *pcb);
/* USER CODE END FunctionPrototypes */
void start_tcp_task(void const *argument);
@ -169,6 +180,51 @@ void start_tcp_task(void const *argument)
/* Infinite loop */
for (;;)
{
uint32_t phyreg = 0;
HAL_ETH_ReadPHYRegister(&heth, 0x00, PHY_BSR, &phyreg);
if (((phyreg >> 2) & 0x1) != 0x1)
{
/* When the netif link is down this function must be called */
netif_set_link_down(&gnetif);
netif_set_down(&gnetif); // 热插拔下线时调用
if (tcp_echo_flags_hart1 == 1)
{
tcp_abort(server_pcb_hart1); // 热插拔下线时调用
}
if (tcp_echo_flags_hart2 == 1)
{
tcp_abort(server_pcb_hart2); // 热插拔下线时调用
}
#if (BLE2_USART6 == 1)
if (tcp_echo_flags_ble1 == 1)
{
tcp_abort(server_pcb_ble1); // 热插拔下线时调用
}
#endif
if (tcp_echo_flags_ble2 == 1)
{
tcp_abort(server_pcb_ble2); // 热插拔下线时调用
}
if (tcp_echo_flags_control == 1)
{
tcp_abort(server_pcb_control); // 热插拔下线时调用
}
tcp_echo_flags_ble1 = 2;
}
else
{
/* 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);
// osThreadTerminate(NULL);
@ -211,7 +267,7 @@ void start_dac_task(void const *argument)
/* Infinite loop */
for (;;)
{
osThreadSuspend(adc_taskHandle); // 暂停ADC任务防止DAC采集时产生干<E7949F>?????,因为ADC和DAC采用的是同一路SPI但是时序不<E5BA8F>?????
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);
@ -234,7 +290,7 @@ void start_adc_task(void const *argument)
/* Infinite loop */
for (;;)
{
osThreadSuspend(dac_taskHandle); // 暂停DAC任务防止ADC采集时产生干<E7949F>?????,因为ADC和DAC采用的是同一路SPI但是时序不<E5BA8F>?????
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

@ -195,7 +195,8 @@ void SystemClock_Config(void)
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
@ -339,8 +340,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
/* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */
if (htim->Instance == TIM4)
{
if (htim->Instance == TIM4) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */

View File

@ -455,6 +455,20 @@ void ETH_IRQHandler(void)
/* USER CODE END ETH_IRQn 1 */
}
/**
* @brief This function handles Ethernet wake-up interrupt through EXTI line 19.
*/
void ETH_WKUP_IRQHandler(void)
{
/* USER CODE BEGIN ETH_WKUP_IRQn 0 */
/* USER CODE END ETH_WKUP_IRQn 0 */
HAL_ETH_IRQHandler(&heth);
/* USER CODE BEGIN ETH_WKUP_IRQn 1 */
/* USER CODE END ETH_WKUP_IRQn 1 */
}
/**
* @brief This function handles DMA2 stream7 global interrupt.
*/

View File

@ -216,3 +216,4 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)
return recved_bytes;
}
#endif /* MDK ARM Compiler */

View File

@ -613,6 +613,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* ethHandle)
/* Peripheral interrupt init */
HAL_NVIC_SetPriority(ETH_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn);
HAL_NVIC_SetPriority(ETH_WKUP_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(ETH_WKUP_IRQn);
/* USER CODE BEGIN ETH_MspInit 1 */
/* USER CODE END ETH_MspInit 1 */
@ -649,6 +651,8 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* ethHandle)
/* Peripheral interrupt Deinit*/
HAL_NVIC_DisableIRQ(ETH_IRQn);
HAL_NVIC_DisableIRQ(ETH_WKUP_IRQn);
/* USER CODE BEGIN ETH_MspDeInit 1 */
/* USER CODE END ETH_MspDeInit 1 */

View File

@ -63,6 +63,10 @@
#define TCP_SNDQUEUELOWAT 5
/*----- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, TCP_MSS*4) -----*/
#define TCP_WND_UPDATE_THRESHOLD 536
/*----- Default Value for LWIP_NETIF_STATUS_CALLBACK: 0 ---*/
#define LWIP_NETIF_STATUS_CALLBACK 1
/*----- Default Value for LWIP_NETIF_EXT_STATUS_CALLBACK: 0 ---*/
#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
/*----- Value in opt.h for LWIP_NETIF_LINK_CALLBACK: 0 -----*/
#define LWIP_NETIF_LINK_CALLBACK 1
/*----- Value in opt.h for TCPIP_THREAD_STACKSIZE: 0 -----*/

View File

@ -160,6 +160,16 @@
<WinNumber>1</WinNumber>
<ItemText>gnetif</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>LAN8742</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>phyreg</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
@ -803,7 +813,7 @@
<Group>
<GroupName>Middlewares/LwIP</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>

View File

@ -0,0 +1,57 @@
<html>
<body>
<pre>
<h1>µVision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: ¦ÌVision V5.36.0.0
Copyright (C) 2021 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: aaa Administrator, aaa, LIC=6XJT4-F8J98-8YUVV-P833R-DBAKX-Y8EU6
Tool Versions:
Toolchain: MDK-ARM Professional Version: 5.36.0.0
Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin
C Compiler: Armcc.exe V5.06 update 7 (build 960)
Assembler: Armasm.exe V5.06 update 7 (build 960)
Linker/Locator: ArmLink.exe V5.06 update 7 (build 960)
Library Manager: ArmAr.exe V5.06 update 7 (build 960)
Hex Converter: FromElf.exe V5.06 update 7 (build 960)
CPU DLL: SARMCM3.DLL V5.36.0.0
Dialog DLL: DCM.DLL V1.17.3.0
Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.9.0
Dialog DLL: TCM.DLL V1.53.0.0
<h2>Project:</h2>
D:\WORK\positioner_testing\Semi-finished product testing\MDK-ARM\semi-finished_product_testing.uvprojx
Project File Date: 03/31/2025
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'semi-finished_product_testing'
"semi-finished_product_testing\semi-finished_product_testing.axf" - 0 Error(s), 0 Warning(s).
<h2>Software Packages used:</h2>
Package Vendor: ARM
http://www.keil.com/pack/ARM.CMSIS.5.8.0.pack
ARM.CMSIS.5.8.0
CMSIS (Common Microcontroller Software Interface Standard)
* Component: CORE Version: 5.5.0
Package Vendor: Keil
https://www.keil.com/pack/Keil.STM32F4xx_DFP.2.17.1.pack
Keil.STM32F4xx_DFP.2.17.1
STMicroelectronics STM32F4 Series Device Support, Drivers and Examples
<h2>Collection of Component include folders:</h2>
.\RTE\_semi-finished_product_testing
C:\Users\Administrator\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include
C:\Users\Administrator\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.17.1\Drivers\CMSIS\Device\ST\STM32F4xx\Include
<h2>Collection of Component Files used:</h2>
* Component: ARM::CMSIS:CORE:5.5.0
Include file: CMSIS\Core\Include\tz_context.h
Build Time Elapsed: 00:00:00
</pre>
</body>
</html>

View File

@ -1305,6 +1305,7 @@
#define TCP_CALCULATE_EFF_SEND_MSS 1
#endif
/**
* TCP_SND_BUF: TCP sender buffer space (bytes).
* To achieve good performance, this should be at least 2 * TCP_MSS.

View File

@ -127,9 +127,11 @@ KeepUserPlacement=false
LWIP.BSP.number=1
LWIP.CMSIS_VERSION-Enabled=1
LWIP.GATEWAY_ADDRESS=192.168.001.029
LWIP.IPParameters=LWIP_DHCP,IP_ADDRESS,NETMASK_ADDRESS,GATEWAY_ADDRESS,LWIP_UDP,CMSIS_VERSION-Enabled
LWIP.IPParameters=LWIP_DHCP,IP_ADDRESS,NETMASK_ADDRESS,GATEWAY_ADDRESS,LWIP_UDP,CMSIS_VERSION-Enabled,LWIP_NETIF_STATUS_CALLBACK,LWIP_NETIF_EXT_STATUS_CALLBACK
LWIP.IP_ADDRESS=192.168.001.100
LWIP.LWIP_DHCP=0
LWIP.LWIP_NETIF_EXT_STATUS_CALLBACK=1
LWIP.LWIP_NETIF_STATUS_CALLBACK=1
LWIP.LWIP_UDP=0
LWIP.NETMASK_ADDRESS=255.255.255.000
LWIP.Version=v2.1.2_Cube