Browse Source

按照原理图中修改debug灯引脚以及genlock引脚

tags/修改需求前并且硬件测试除rs485都通过的版本
tianjialong 2 years ago
parent
commit
76dcedd116
  1. 9
      Inc/main.h
  2. 1
      Inc/stm32f4xx_it.h
  3. 46
      LWIP.ioc
  4. 48
      MDK-ARM/LWIP.uvoptx
  5. 1080
      MDK-ARM/LWIP.uvprojx
  6. 30
      Src/gpio.c
  7. 14
      Src/stm32f4xx_it.c

9
Inc/main.h

@ -58,17 +58,16 @@ void Error_Handler(void);
/* USER CODE END EFP */ /* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/ /* Private defines -----------------------------------------------------------*/
#define GENLOCK_Pin GPIO_PIN_2
#define GENLOCK_GPIO_Port GPIOE
#define GENLOCK_EXTI_IRQn EXTI2_IRQn
#define DEBUG_LIGHT_Pin GPIO_PIN_2
#define DEBUG_LIGHT_GPIO_Port GPIOE
#define KEY1_Pin GPIO_PIN_3 #define KEY1_Pin GPIO_PIN_3
#define KEY1_GPIO_Port GPIOE #define KEY1_GPIO_Port GPIOE
#define KEY0_Pin GPIO_PIN_4 #define KEY0_Pin GPIO_PIN_4
#define KEY0_GPIO_Port GPIOE #define KEY0_GPIO_Port GPIOE
#define ENCODER_LIGHT_Pin GPIO_PIN_9 #define ENCODER_LIGHT_Pin GPIO_PIN_9
#define ENCODER_LIGHT_GPIO_Port GPIOF #define ENCODER_LIGHT_GPIO_Port GPIOF
#define DEBUG_LIGHT_Pin GPIO_PIN_10
#define DEBUG_LIGHT_GPIO_Port GPIOF
#define GENLOCK_Pin GPIO_PIN_8
#define GENLOCK_GPIO_Port GPIOD
#define ETH_RST_Pin GPIO_PIN_3 #define ETH_RST_Pin GPIO_PIN_3
#define ETH_RST_GPIO_Port GPIOD #define ETH_RST_GPIO_Port GPIOD

1
Inc/stm32f4xx_it.h

@ -52,7 +52,6 @@ void MemManage_Handler(void);
void BusFault_Handler(void); void BusFault_Handler(void);
void UsageFault_Handler(void); void UsageFault_Handler(void);
void DebugMon_Handler(void); void DebugMon_Handler(void);
void EXTI2_IRQHandler(void);
void TIM1_UP_TIM10_IRQHandler(void); void TIM1_UP_TIM10_IRQHandler(void);
void USART1_IRQHandler(void); void USART1_IRQHandler(void);
void TIM6_DAC_IRQHandler(void); void TIM6_DAC_IRQHandler(void);

46
LWIP.ioc

@ -52,12 +52,12 @@ Mcu.Name=STM32F407Z(E-G)Tx
Mcu.Package=LQFP144 Mcu.Package=LQFP144
Mcu.Pin0=PE2 Mcu.Pin0=PE2
Mcu.Pin1=PE3 Mcu.Pin1=PE3
Mcu.Pin10=PA7
Mcu.Pin11=PC4
Mcu.Pin12=PC5
Mcu.Pin13=PB11
Mcu.Pin14=PB12
Mcu.Pin15=PB13
Mcu.Pin10=PC4
Mcu.Pin11=PC5
Mcu.Pin12=PB11
Mcu.Pin13=PB12
Mcu.Pin14=PB13
Mcu.Pin15=PD8
Mcu.Pin16=PD12 Mcu.Pin16=PD12
Mcu.Pin17=PD13 Mcu.Pin17=PD13
Mcu.Pin18=PC6 Mcu.Pin18=PC6
@ -73,12 +73,12 @@ Mcu.Pin26=VP_LWIP_VS_Enabled
Mcu.Pin27=VP_SYS_VS_tim1 Mcu.Pin27=VP_SYS_VS_tim1
Mcu.Pin28=VP_TIM6_VS_ClockSourceINT Mcu.Pin28=VP_TIM6_VS_ClockSourceINT
Mcu.Pin3=PF9 Mcu.Pin3=PF9
Mcu.Pin4=PF10
Mcu.Pin5=PH0-OSC_IN
Mcu.Pin6=PH1-OSC_OUT
Mcu.Pin7=PC1
Mcu.Pin8=PA1
Mcu.Pin9=PA2
Mcu.Pin4=PH0-OSC_IN
Mcu.Pin5=PH1-OSC_OUT
Mcu.Pin6=PC1
Mcu.Pin7=PA1
Mcu.Pin8=PA2
Mcu.Pin9=PA7
Mcu.PinsNb=29 Mcu.PinsNb=29
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
@ -88,7 +88,6 @@ MxDb.Version=DB.6.0.70
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.ETH_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true NVIC.ETH_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
NVIC.EXTI2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.ForceEnableDMAVector=true NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
@ -151,12 +150,14 @@ PD3.GPIOParameters=GPIO_Label
PD3.GPIO_Label=ETH_RST PD3.GPIO_Label=ETH_RST
PD3.Locked=true PD3.Locked=true
PD3.Signal=GPIO_Output PD3.Signal=GPIO_Output
PE2.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
PE2.GPIO_Label=GENLOCK
PE2.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
PE2.GPIO_PuPd=GPIO_PULLUP
PD8.GPIOParameters=GPIO_Label
PD8.GPIO_Label=GENLOCK
PD8.Locked=true
PD8.Signal=GPXTI8
PE2.GPIOParameters=GPIO_Label
PE2.GPIO_Label=DEBUG_LIGHT
PE2.Locked=true PE2.Locked=true
PE2.Signal=GPXTI2
PE2.Signal=GPIO_Output
PE3.GPIOParameters=GPIO_PuPd,GPIO_Label PE3.GPIOParameters=GPIO_PuPd,GPIO_Label
PE3.GPIO_Label=KEY1 PE3.GPIO_Label=KEY1
PE3.GPIO_PuPd=GPIO_PULLUP PE3.GPIO_PuPd=GPIO_PULLUP
@ -167,11 +168,6 @@ PE4.GPIO_Label=KEY0
PE4.GPIO_PuPd=GPIO_PULLUP PE4.GPIO_PuPd=GPIO_PULLUP
PE4.Locked=true PE4.Locked=true
PE4.Signal=GPIO_Input PE4.Signal=GPIO_Input
PF10.GPIOParameters=GPIO_PuPd,GPIO_Label
PF10.GPIO_Label=DEBUG_LIGHT
PF10.GPIO_PuPd=GPIO_PULLUP
PF10.Locked=true
PF10.Signal=GPIO_Output
PF9.GPIOParameters=GPIO_PuPd,GPIO_Label PF9.GPIOParameters=GPIO_PuPd,GPIO_Label
PF9.GPIO_Label=ENCODER_LIGHT PF9.GPIO_Label=ENCODER_LIGHT
PF9.GPIO_PuPd=GPIO_PULLUP PF9.GPIO_PuPd=GPIO_PULLUP
@ -242,8 +238,8 @@ RCC.VCOI2SOutputFreq_Value=384000000
RCC.VCOInputFreq_Value=2000000 RCC.VCOInputFreq_Value=2000000
RCC.VCOOutputFreq_Value=336000000 RCC.VCOOutputFreq_Value=336000000
RCC.VcooutputI2S=192000000 RCC.VcooutputI2S=192000000
SH.GPXTI2.0=GPIO_EXTI2
SH.GPXTI2.ConfNb=1
SH.GPXTI8.0=GPIO_EXTI8
SH.GPXTI8.ConfNb=1
SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface
SH.S_TIM4_CH1.ConfNb=1 SH.S_TIM4_CH1.ConfNb=1
SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface

48
MDK-ARM/LWIP.uvoptx

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml version="1.0" encoding="UTF-8"?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd"> <ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion> <SchemaVersion>1.0</SchemaVersion>
@ -45,7 +45,7 @@
<PageWidth>79</PageWidth> <PageWidth>79</PageWidth>
<PageLength>66</PageLength> <PageLength>66</PageLength>
<TabStop>8</TabStop> <TabStop>8</TabStop>
<ListingPath></ListingPath>
<ListingPath />
</OPTLEX> </OPTLEX>
<ListingPage> <ListingPage>
<CreateCListing>1</CreateCListing> <CreateCListing>1</CreateCListing>
@ -104,16 +104,16 @@
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>3</nTsel> <nTsel>3</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<sDll />
<sDllPa />
<sDlgDll />
<sDlgPa />
<sIfile />
<tDll />
<tDllPa />
<tDlgDll />
<tDlgPa />
<tIfile />
<pMon>BIN\CMSIS_AGDI.dll</pMon> <pMon>BIN\CMSIS_AGDI.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
@ -130,12 +130,12 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>ARMDBGFLAGS</Key> <Key>ARMDBGFLAGS</Key>
<Name></Name>
<Name />
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGUARM</Key> <Key>DLGUARM</Key>
<Name></Name>
<Name />
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -195,19 +195,19 @@
<newCpu>0</newCpu> <newCpu>0</newCpu>
<uProt>0</uProt> <uProt>0</uProt>
</DebugFlag> </DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<LintExecutable />
<LintConfigFile />
<bLintAuto>0</bLintAuto> <bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD> <bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags> <LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<pMisraName />
<pszMrule />
<pSingCmds />
<pMultCmds />
<pMisraNamep />
<pszMrulep />
<pSingCmdsp />
<pMultCmdsp />
<DebugDescription> <DebugDescription>
<Enable>1</Enable> <Enable>1</Enable>
<EnableFlashSeq>0</EnableFlashSeq> <EnableFlashSeq>0</EnableFlashSeq>

1080
MDK-ARM/LWIP.uvprojx
File diff suppressed because it is too large
View File

30
Src/gpio.c

@ -54,16 +54,20 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOF, ENCODER_LIGHT_Pin|DEBUG_LIGHT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(DEBUG_LIGHT_GPIO_Port, DEBUG_LIGHT_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(ENCODER_LIGHT_GPIO_Port, ENCODER_LIGHT_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(ETH_RST_GPIO_Port, ETH_RST_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(ETH_RST_GPIO_Port, ETH_RST_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = GENLOCK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GENLOCK_GPIO_Port, &GPIO_InitStruct);
GPIO_InitStruct.Pin = DEBUG_LIGHT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(DEBUG_LIGHT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PEPin PEPin */ /*Configure GPIO pins : PEPin PEPin */
GPIO_InitStruct.Pin = KEY1_Pin|KEY0_Pin; GPIO_InitStruct.Pin = KEY1_Pin|KEY0_Pin;
@ -71,12 +75,18 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/*Configure GPIO pins : PFPin PFPin */
GPIO_InitStruct.Pin = ENCODER_LIGHT_Pin|DEBUG_LIGHT_Pin;
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = ENCODER_LIGHT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
HAL_GPIO_Init(ENCODER_LIGHT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = GENLOCK_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GENLOCK_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = ETH_RST_Pin; GPIO_InitStruct.Pin = ETH_RST_Pin;
@ -85,10 +95,6 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(ETH_RST_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(ETH_RST_GPIO_Port, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI2_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
} }
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */

14
Src/stm32f4xx_it.c

@ -161,20 +161,6 @@ void DebugMon_Handler(void)
/******************************************************************************/ /******************************************************************************/
/** /**
* @brief This function handles EXTI line2 interrupt.
*/
void EXTI2_IRQHandler(void)
{
/* USER CODE BEGIN EXTI2_IRQn 0 */
/* USER CODE END EXTI2_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GENLOCK_Pin);
/* USER CODE BEGIN EXTI2_IRQn 1 */
/* USER CODE END EXTI2_IRQn 1 */
}
/**
* @brief This function handles TIM1 update interrupt and TIM10 global interrupt. * @brief This function handles TIM1 update interrupt and TIM10 global interrupt.
*/ */
void TIM1_UP_TIM10_IRQHandler(void) void TIM1_UP_TIM10_IRQHandler(void)

Loading…
Cancel
Save