Changeset 23 for trunk/fw_g473rct/Core/Src/usart.c
- Timestamp:
- Aug 29, 2025, 7:18:36 PM (15 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/fw_g473rct/Core/Src/usart.c
r22 r23 28 28 UART_HandleTypeDef huart2; 29 29 DMA_HandleTypeDef hdma_usart2_rx; 30 DMA_HandleTypeDef hdma_usart2_tx; 30 31 31 32 /* USART1 init function */ … … 86 87 /* USER CODE END USART2_Init 1 */ 87 88 huart2.Instance = USART2; 88 huart2.Init.BaudRate = 1 15200;89 huart2.Init.BaudRate = 19200; 89 90 huart2.Init.WordLength = UART_WORDLENGTH_9B; 90 91 huart2.Init.StopBits = UART_STOPBITS_1; … … 209 210 __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart2_rx); 210 211 212 /* USART2_TX Init */ 213 hdma_usart2_tx.Instance = DMA1_Channel7; 214 hdma_usart2_tx.Init.Request = DMA_REQUEST_USART2_TX; 215 hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH; 216 hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE; 217 hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE; 218 hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; 219 hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; 220 hdma_usart2_tx.Init.Mode = DMA_NORMAL; 221 hdma_usart2_tx.Init.Priority = DMA_PRIORITY_LOW; 222 if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK) 223 { 224 Error_Handler(); 225 } 226 227 __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx); 228 211 229 /* USART2 interrupt Init */ 212 230 HAL_NVIC_SetPriority(USART2_IRQn, 0, 0); … … 257 275 /* USART2 DMA DeInit */ 258 276 HAL_DMA_DeInit(uartHandle->hdmarx); 277 HAL_DMA_DeInit(uartHandle->hdmatx); 259 278 260 279 /* USART2 interrupt Deinit */
Note: See TracChangeset
for help on using the changeset viewer.