2019-07-14 15:09发布
TOPCB 发表于 2018-12-18 16:50 本帖最后由 安 于 2018-2-11 10:56 编辑 重新初始化串口试一下。看样子像是串口没有初始化。 HAL_UART_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use Value is allowed for gState and RxState */
最多设置5个标签!
回复:安: 我的串口已经进行过了初始化,APP中的代码如下:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
MX_UART4_Init();
、、-------------------------------------------
void MX_USART1_UART_Init(void)
{
HAL_UART_MspDeInit(&huart1);
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
// huart1.Init.OverSampling = UART_OVERSAMPLING_16;
// huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
// huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
HAL_UART_MspInit(&huart1);
一周热门 更多>