Skip to main content
jiangpen
Associate III
June 15, 2018
Question

stm32F04 HAL_UART_ErrorCallback is called when set both usart1 and usart2 rx pin to pull-down

  • June 15, 2018
  • 1 reply
  • 395 views
Posted on June 15, 2018 at 10:12

Dear all,

Now I meet a strange problem that when I set the uart1 and uart2 pull from PULLUP to PULLDOWN, then I got the Uart errror, HAL_UART_ErrorCallback is called.

May I know any limitation about the PULLDOWN setting about Uart ? Interest thing is if just one of them set to pull down, then it is OK. This error only happens when both of them set to PULLDOWN.

Any clues about that is really appreciated.

Thanks a lot

    GPIO_InitStruct.Pin = GPIO_PIN_7;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_PULLDOWN;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF0_USART1;

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_3;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_PULLDOWN;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF1_USART2;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    This topic has been closed for replies.

    1 reply

    Thomas Fischer
    Associate II
    June 15, 2018
    Posted on June 15, 2018 at 10:48

    Normally the usart rx line is high if inactive (no data transmission).

    If the RX Pin is pulled low, the uart starts to sample for incoming bytes,

    it does not detect a stop bit, so you will get framing errors and possible

    other errors like overrun, parity error.

    See Usart frame format in reference manual.

    Usart Rx level should alway be pulled to inactive level, that is normally high