5. 设置串口GPIO
编写程序:
int main(void)
{
HAL_StatusTypeDef hal_status;
uint8_t aRxBuffer[SENDBUFF_SIZE]= {
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20 };
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_USART6_UART_Init();
hal_status = HAL_UART_Transmit_DMA(&huart6,aRxBuffer, SENDBUFF_SIZE);
}
测试结果:连接好串口线,打开调试助手会不断的接收到数据。