Skip to main content
Associate II
April 18, 2024
Question

USART1 and USART2 STM32H7B3I-DK

  • April 18, 2024
  • 3 replies
  • 2792 views

Hello everyone!

I am working with STM32H7B3I-DK and I have enabled USART1 based on the available example, but I need to enable USART2 to connect to the WiFi. If I use the same code but with RX and TX pins from USART2, I can see nothing on console. Do I need to enable additional pins for USART2 ?

Thanks in advance!

3 replies

mƎALLEm
ST Technical Moderator
April 18, 2024

Hello,

If you want to "port" an UART function to another, you need to insure:

  • The right UART pins configs and their alternate functions. As well as the RCC clock enable of the port(s) on which the pins are belonging.
  • The RCC Clock enable of the UART.
  • The UART RCC clock source.

Are you using CubeMx tool? it can help you to overcome all these complexities.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
User1340Author
Associate II
April 19, 2024

Thank you on your fast response! Yes, I am working through CubeMX tool. I have configured:
-USART2_CTS(PA0)

-USART2_TX(PD5)

-USART2_RX(PD6)
-USART2_RTS(PD4)
Unfortunately, I still cannot see anything on console. 
Can you help me with RCC configurations?
I am so sorry but I am really struggling with this board and the documentation about this section is really poor. 

Andrew Neil
Super User
April 18, 2024

@User1340 wrote:

If I use the same code but with RX and TX pins from USART2


If all you do is change the RX & TX pins, then the rest of the code will will be using USART1 !

Are you doing this with CubeMX & HAL, or at register level?

Even if you don't plan on using CubeMX for your final code, start by using it, to see how it does this - then adapt that to your own code.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
User1340Author
Associate II
April 19, 2024

Yes, I am working with CubeMX and HAL and still facing issues and couldn't enable the USART2...

Tesla DeLorean
Guru
April 19, 2024

The Console, on a PC connected too the ST-LINK VCP? 

If that's physically connected to USART1 you're not going to see interactions on USART2 connected to a WiFi module.

If you want to interact with that on the PC you'll need to forward back and forth between USART1 and USART2 in your code.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
User1340Author
Associate II
April 19, 2024

I am using option in the console Command Shell Console and it is configured just as settings of the USART2 (port, baud rate, data bits, stop bits and parity) and it could be used for any usart probably.. 
To be clear, I have disabled USART1 and only enabled USART2 to communicate...

Andrew Neil
Super User
April 19, 2024

@User1340 wrote:

I am using option in the console Command Shell Console and it is configured just as settings of the USART2 (port, baud rate, data bits, stop bits and parity) and it could be used for any usart probably.. 


Yes, it can be used for any USART - but how have you physically connected USART2 from your target system to this Command Shell Console  on your computer?

 


@User1340 wrote:

To be clear, I have disabled USART1 and only enabled USART2 to communicate...


That doesn't clarify anything at all.

Enabling USART2 to communicate will not provide any connection from that USART to the PC.

How do you make the physical connection from USART2 to the PC?

 

EDIT:

As you can see from the User Manual, USART1 is connected to the ST-Link (Red), but USART2 is not (Blue):

AndrewNeil_0-1713524185064.png

So you're going to need to make some other arrangement to get the signals from USART2 to the PC ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.