13114515ad
Affected files: _resources/Pasted image 20240618084710.png _resources/Pasted image 20240618084749.png 代码/串口DMA不定长接收.md 代码/状态机接收不定长数据.md
847 B
847 B
title | updated | created | tags | |||||
---|---|---|---|---|---|---|---|---|
串口DMA不定长接收 | 2022-01-11 01:27:13Z | 2022-01-08 13:18:08Z |
|
串口不定长接收利用的是串口接收中的空闲中断
处理空闲中断
/**
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
uint32_t flag,tmp;
flag = __HAL_UART_GET_FLAG(&huart1,UART_FLAG_IDLE);
if (flag != RESET) {
__HAL_UART_CLEAR_IDLEFLAG(&huart1);
tmp = huart1.Instance->SR;
tmp = huart1.Instance->DR;
HAL_UART_DMAStop(&huart1);
tmp = hdma_usart1_rx.Instance->CNDTR;
rxlen = 200 - tmp;
isrxend = 1;
}
/* USER CODE END USART1_IRQn 0 */
HAL_UART_IRQHandler(&huart1);
/* USER CODE BEGIN USART1_IRQn 1 */
/* USER CODE END USART1_IRQn 1 */
}
</div>
#串口 #mcu #代码块