回退 V2 引脚补丁:v2-on-ui 沿用 v2 硬件引脚(LED2=PB0 驱动致板级电源/复位跌落,开机死亡)

This commit is contained in:
2026-09-19 20:32:26 +08:00
parent 6ebdb14724
commit 65b8fb05d5
4 changed files with 41 additions and 46 deletions
+6 -6
View File
@@ -59,10 +59,10 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define CH395_INT_Pin GPIO_PIN_5
#define CH395_INT_GPIO_Port GPIOE
#define LED1_Pin GPIO_PIN_5
#define LED1_Pin GPIO_PIN_4
#define LED1_GPIO_Port GPIOC
#define LED2_Pin GPIO_PIN_0
#define LED2_GPIO_Port GPIOB
#define LED2_Pin GPIO_PIN_5
#define LED2_GPIO_Port GPIOC
#define LED3_Pin GPIO_PIN_1
#define LED3_GPIO_Port GPIOB
#define LED4_Pin GPIO_PIN_2
@@ -89,10 +89,10 @@ void Error_Handler(void);
#define CH395_SCS_GPIO_Port GPIOB
#define CH395F_SCK_Pin GPIO_PIN_13
#define CH395F_SCK_GPIO_Port GPIOB
#define CH395F_SDI_Pin GPIO_PIN_14
#define CH395F_SDI_GPIO_Port GPIOB
#define CH395F_SDO_Pin GPIO_PIN_15
#define CH395F_SDO_Pin GPIO_PIN_14
#define CH395F_SDO_GPIO_Port GPIOB
#define CH395F_SDOB15_Pin GPIO_PIN_15
#define CH395F_SDOB15_GPIO_Port GPIOB
#define DB2_Pin GPIO_PIN_2
#define DB2_GPIO_Port GPIOG
#define DB3_Pin GPIO_PIN_3
+19 -16
View File
@@ -120,7 +120,7 @@ Mcu.Pin26=PG8
Mcu.Pin27=PA9
Mcu.Pin28=PA10
Mcu.Pin29=PA13
Mcu.Pin3=PC5
Mcu.Pin3=PC4
Mcu.Pin30=PA14
Mcu.Pin31=PC10
Mcu.Pin32=PC11
@@ -131,7 +131,7 @@ Mcu.Pin36=PD2
Mcu.Pin37=PD3
Mcu.Pin38=PD4
Mcu.Pin39=PD5
Mcu.Pin4=PB0
Mcu.Pin4=PC5
Mcu.Pin40=PD6
Mcu.Pin41=PD7
Mcu.Pin42=PG9
@@ -160,8 +160,8 @@ Mcu.PinsNb=59
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F407ZGTx
MxCube.Version=6.18.1
MxDb.Version=DB.6.0.181
MxCube.Version=6.17.0
MxDb.Version=DB.6.0.170
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.DMA1_Stream3_IRQn=true\:7\:0\:true\:false\:true\:true\:false\:true\:true
NVIC.DMA1_Stream4_IRQn=true\:7\:0\:true\:false\:true\:true\:false\:true\:true
@@ -209,13 +209,10 @@ PA9.GPIO_PuPd=GPIO_NOPULL
PA9.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
PB0.GPIOParameters=PinState,GPIO_Label
PB0.GPIO_Label=LED2
PB0.Locked=true
PB0.PinState=GPIO_PIN_SET
PB0.Signal=GPIO_Output
PB1.GPIOParameters=PinState,GPIO_Label
PB1.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
PB1.GPIO_Label=LED3
PB1.GPIO_PuPd=GPIO_PULLUP
PB1.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PB1.Locked=true
PB1.PinState=GPIO_PIN_SET
PB1.Signal=GPIO_Output
@@ -242,7 +239,7 @@ PB13.Locked=true
PB13.Mode=Full_Duplex_Master
PB13.Signal=SPI2_SCK
PB14.GPIOParameters=GPIO_PuPd,GPIO_Label
PB14.GPIO_Label=CH395F_SDI
PB14.GPIO_Label=CH395F_SDO
PB14.GPIO_PuPd=GPIO_PULLUP
PB14.Locked=true
PB14.Mode=Full_Duplex_Master
@@ -309,19 +306,25 @@ PC12.GPIO_Label=ST_TX4
PC12.Locked=true
PC12.Mode=Asynchronous
PC12.Signal=UART5_TX
PC5.GPIOParameters=PinState,GPIO_Label
PC5.GPIO_Label=LED1
PC4.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
PC4.GPIO_Label=LED1
PC4.GPIO_PuPd=GPIO_PULLUP
PC4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PC4.Locked=true
PC4.PinState=GPIO_PIN_SET
PC4.Signal=GPIO_Output
PC5.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
PC5.GPIO_Label=LED2
PC5.GPIO_PuPd=GPIO_PULLUP
PC5.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PC5.Locked=true
PC5.PinState=GPIO_PIN_SET
PC5.Signal=GPIO_Output
PCC.Bar.Display=Horizontal Bar
PCC.Checker=false
PCC.Display=Plot\: All Steps
PCC.Line=STM32F407/417
PCC.MCU=STM32F407Z(E-G)Tx
PCC.PartNumber=STM32F407ZGTx
PCC.SequenceTime=1.0 ms
PCC.SequenceTime.Unit=ms
PCC.Series=STM32F4
PCC.Temperature=25
PCC.Vdd=3.3
+12 -20
View File
@@ -55,11 +55,10 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC, LED1_Pin|LED2_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LED2_Pin|LED3_Pin|LED4_Pin|CH395_SCS_Pin
|GD_WP_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, LED3_Pin|LED4_Pin|CH395_SCS_Pin|GD_WP_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOF, LED5_Pin|LED6_Pin, GPIO_PIN_SET);
@@ -82,26 +81,19 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(CH395_INT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : LED1_Pin */
GPIO_InitStruct.Pin = LED1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : LED2_Pin LED3_Pin */
GPIO_InitStruct.Pin = LED2_Pin|LED3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : LED4_Pin */
GPIO_InitStruct.Pin = LED4_Pin;
/*Configure GPIO pins : LED1_Pin LED2_Pin */
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED4_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : LED3_Pin LED4_Pin */
GPIO_InitStruct.Pin = LED3_Pin|LED4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : LED5_Pin LED6_Pin */
GPIO_InitStruct.Pin = LED5_Pin|LED6_Pin;
+4 -4
View File
@@ -179,19 +179,19 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
PB14 ------> SPI2_MISO
PB15 ------> SPI2_MOSI
*/
GPIO_InitStruct.Pin = CH395F_SCK_Pin|CH395F_SDO_Pin;
GPIO_InitStruct.Pin = CH395F_SCK_Pin|CH395F_SDOB15_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Pin = CH395F_SDI_Pin;
GPIO_InitStruct.Pin = CH395F_SDO_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
HAL_GPIO_Init(CH395F_SDI_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_Init(CH395F_SDO_GPIO_Port, &GPIO_InitStruct);
/* SPI2 DMA Init */
/* SPI2_RX Init */
@@ -280,7 +280,7 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
PB14 ------> SPI2_MISO
PB15 ------> SPI2_MOSI
*/
HAL_GPIO_DeInit(GPIOB, CH395F_SCK_Pin|CH395F_SDI_Pin|CH395F_SDO_Pin);
HAL_GPIO_DeInit(GPIOB, CH395F_SCK_Pin|CH395F_SDO_Pin|CH395F_SDOB15_Pin);
/* SPI2 DMA DeInit */
HAL_DMA_DeInit(spiHandle->hdmarx);