2024-01-20 03:22 AM - edited 2024-01-22 09:44 AM
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
Solved! Go to Solution.
2024-01-27 04:07 AM
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
2024-01-20 04:15 AM
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
2024-01-20 04:20 AM - edited 2024-01-20 04:22 AM
Thank you for your reply
but the HSE is already disabled, I am using the internal clocks
2024-01-20 04:25 AM
Interesting ! And what is your UART4 baudrate ? We need to replicated such behavior never seen before .
Cheers,
STOne-32
2024-01-20 04:26 AM - edited 2024-01-20 05:55 AM
I tested it starting from 9600, 115200 to 512000
2024-01-27 04:07 AM
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
2024-01-27 04:18 AM
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
2024-01-27 04:20 AM - edited 2024-01-27 04:26 AM
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.