summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/master.c2
-rw-r--r--src/stm32f4xx_hal_msp.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/src/master.c b/src/master.c
index c627a45..2b8401a 100644
--- a/src/master.c
+++ b/src/master.c
@@ -910,7 +910,7 @@ static void MX_I2C1_Init(void)
*/
static void MX_USART1_UART_Init(void)
{
- huart1.Instance = USART1;
+ huart1.Instance = USART2;
huart1.Init.BaudRate = 9600;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
diff --git a/src/stm32f4xx_hal_msp.c b/src/stm32f4xx_hal_msp.c
index d19bcec..f379a96 100644
--- a/src/stm32f4xx_hal_msp.c
+++ b/src/stm32f4xx_hal_msp.c
@@ -175,7 +175,30 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
/* USER CODE END USART1_MspInit 1 */
}
+ else if(huart->Instance==USART2)
+ {
+ /* USER CODE BEGIN USART2_MspInit 0 */
+ /* USER CODE END USART2_MspInit 0 */
+ /* Peripheral clock enable */
+ __HAL_RCC_USART2_CLK_ENABLE();
+
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ /**USART2 GPIO Configuration
+ PA2 ------> USART2_TX
+ PA3 ------> USART2_RX
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_PULLUP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN USART2_MspInit 1 */
+
+ /* USER CODE END USART2_MspInit 1 */
+ }
}
/**