回退 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
+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);