外设资源实验6-USART2的DMA收发实验
实验目的:掌握USART2的DMA接收方式。
实验现象:LoRa节点,使用USART2的DMA接收功能接收串口数据。如果接收到的50个字节的数组的最后一个字节是0xEE,回复“Recive OK”,并且反转K1-LED。
实验代码
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
Task_BrdInit();
/* USER CODE END 2 */
/* Infinite loop