Skip to main content
Visitor II
January 20, 2024
Solved

There is UART BUG on STM32F446RCT6

  • January 20, 2024
  • 3 replies
  • 2088 views

STM32CUBEIDE:  version 1.14.1
PA0-WKUP ------> UART4_TX
PA1 ------> UART4_RX

On a new project when enabling the UART4 with interrupt on receive ,everything is working normal .
But once I enable PH1 pin as a GPIO_OUTPUT the UART is not transmitting or receiving any more.

Any ideas or help please?

Update 1: I attached the two code form comparing.
Update 2: if I configure the PH1 pin as input the UART4 will work normal

    This topic has been closed for replies.
    Best answer by Mugtaba

    I have solved the problem by my self, I had to enable the printf and scanf as I have used them as UART transmission function from the project settings (didn't know why it is working once the PH1 pin is disabled)
    also I added this line before the while (1) __HAL_UART_ENABLE_IT(&huart4,UART_IT_RXNE);


    @Mugtaba wrote:

    STM32CUBEIDE:  version 1.14.1
    PA0-WKUP ------> UART4_TX
    PA1 ------> UART4_RX

    On a new project when enabling the UART4 with interrupt on receive ,everything is working normal .
    But once I enable PH1 pin as a GPIO_OUTPUT the UART is not transmitting or receiving any more.


    For the PH1 pin still don't know I am leaving it for the STM team

    3 replies

    Technical Moderator
    January 20, 2024

    Dear @Mugtaba ,

     

    PH0 and PH1 are used by the HSE - High speed crystal oscillator for precise clock and get right UART baudrate , if PH1 is configured as GPIO , the system will run on internal HSI and your  UART baudrate will be lost and so stopping at application level . Can you check your clocks ?

     

    Cheers,

     

    STOne-32

    MugtabaAuthor
    Visitor II
    January 20, 2024

    Thank you for your reply
    but the HSE is already disabled, I am using the internal clocks

    Mugtaba_0-1705753317991.png

     

    Technical Moderator
    January 20, 2024

    Interesting ! And what is your UART4 baudrate ? We need to replicated such behavior never seen before .

    Cheers,

    STOne-32

    MugtabaAuthorAnswer
    Visitor II
    January 27, 2024

    I have solved the problem by my self, I had to enable the printf and scanf as I have used them as UART transmission function from the project settings (didn't know why it is working once the PH1 pin is disabled)
    also I added this line before the while (1) __HAL_UART_ENABLE_IT(&huart4,UART_IT_RXNE);


    @Mugtaba wrote:

    STM32CUBEIDE:  version 1.14.1
    PA0-WKUP ------> UART4_TX
    PA1 ------> UART4_RX

    On a new project when enabling the UART4 with interrupt on receive ,everything is working normal .
    But once I enable PH1 pin as a GPIO_OUTPUT the UART is not transmitting or receiving any more.


    For the PH1 pin still don't know I am leaving it for the STM team

    Technical Moderator
    January 27, 2024

    Dear @Mugtaba ,

    glad to see you solved the problem observed . however this is weird to have a link between printf / scanf and PH1 GPIO activation ! To fully understand the root cause :  sharing the full project and settings are helpful.

    Cheers,

    STOne-32

    MugtabaAuthor
    Visitor II
    January 27, 2024

    Thank you for your reply
    I did share (on the question it self as attachment) the two project when the PH1 is enabled and disabled.