2024-03-18 03:39 AM
I am using the STM32U5A9J-DK for a UART communication test, and I expect to display the content sent from the computer's Serial port on the screen (textArea).
I'm using UART1, 115200 Baud rate, 8 data bits, 1 stop bits, and I've turned on the UART interrupt, but for some reason the text on the screen doesn't change.
There are not many examples that I can find, so I hope someone can help me to clear this up!
Here is my code
Solved! Go to Solution.
2024-03-25 07:47 PM
Update the status of this issue:
I have now resolved the issue with the UART communication problem, and I will move the rest of the questions to a new thread.
Thanks again to everyone who replied to this thread! :folded_hands:
Here is my test code for anyone using the STM32U5A9J-DK development board for UART communication, hope it helps!
2024-03-18 06:14 AM
Hello @jessie_chiu ,
you are sharing the IOC file and it seems like you are not using the correct pins for UART communication . the UART instance connected to VCP (virtual com port)of STlink is UART1 on pins PA8 and PA9. check you configuration to make sure you are using the correct pins and if you are using printf to display the text make sure you are correctly surcharging it .
BR
2024-03-18 06:59 AM
@jessie_chiu wrote:for some reason the text on the screen doesn't change.
So have you checked that any data is being received?
2024-03-18 08:53 AM
Hello,
As stated by @STea you're not assigning the correct IOs for UART1 to connect it to VCP:
So replace PB6 by PA9 and PB7 by PA10 in CubeMx.
2024-03-18 06:02 PM
Thank you for your reply. I didn't notice the pin problem!!
But after I fixed the pin define, I still don't get the message.
Do you have any other suggestions?
2024-03-18 06:19 PM
Hello @jessie_chiu ,
after making sure that you pinout configuration is good you should verify the baudrate and UART related configuration from the PC terminal side is matching .
if you are using Pritnf to output messages here is what you need to add to you main file
2024-03-19 02:16 AM - edited 2024-03-19 02:24 AM
hi @STea , I referenced the article you mentioned, thanks for your help.
This is what I found:
1. If I generate the project directly from cubeIDE, I can receive messages from the serial monitor.
2. if the project is generated by TouchGFX, using the same code will not work.
I'm not sure if this has anything to do with the FreeRTOS setup, hopefully someone can give me some experience with this. :folded_hands:
2024-03-19 03:54 AM
2. if the project is generated by TouchGFX, using the same code will not work.
You didn't mention if you already succeeded with a simple code: no TouchGFX nor RTOS!
Did you try a simple project using UART? This is the first step you need to do at least to validate your HW+UART config.
Another thing to have in mind, check the conflicting resources between UART and the display/Touch screen pins: it could be a GPIO conflict between UART pins and the LCD/Touch screen pins you are using.
2024-03-19 05:54 PM
Sorry if I was not clear enough. I used the simple code from the article and got 1.
So HW+UART config is communicable.
2024-03-20 05:24 AM
In that case as I said try to find the conflicting ressources between TouchGFX and UART