STM32 serial port DMA variable length reception
When configuring the serial port, open the serial port interrupt, open the receiving and sending DMA
main.c
Front
/* USER CODE BEGIN 0 */
#define BUFFERSIZE 255//可以接收的最大字符个数
uint8_t ReceiveBuff[BUFFERSIZE]; //接收缓冲区
uint8_t Rx_len;//接收完成中断标志,接收到字符长度
extern DMA_HandleTypeDef hdma_usart1_rx