2025-11-14 5:15 AM - last edited on 2025-11-14 5:18 AM by mƎALLEm
Good morning,
I need to connect two h7a3zi-q board via uart (only one way required), but by only connecting tx1->rx2 the programs run but I get empty strings, and by also connecting the grounds of the two boards the tx program gives HardFault. I'm sure of the content of the msgs as I also send via uart3 to my pc and I have no problems.
Any tips?
Thx
2025-11-14 5:23 AM
Hello,
You can refer to any of the example provided in CubeH7:
https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/NUCLEO-H7A3ZI-Q/Examples/UART
All the examples are using two board connected over UART to transmit messages:
2025-11-14 5:24 AM - edited 2025-11-14 6:56 AM
Showing your code tx/rx loop might help here. Make sure that the rx is always receiving, and you may start by receiving single bytes in an endless polling loop.
hth
KnarfB
2025-11-14 5:48 AM
Just to make sure, you confirm that connecting the grounds is required? my working theory is that the rx reads only empty strings as it doesn't have a reference value to distinguish 0 bit to 1 bit, but it doesn't explain why the program gives error if the gnds are connected
2025-11-14 5:56 AM
@Jack_DB wrote:
Just to make sure, you confirm that connecting the grounds is required?
It's mandatory.
Refer to the readme file of one of the examples provided above:
That's not only related to USART but to the most communication interfaces between boards except the differential communication protocols (like CAN for example).
2025-11-14 6:00 AM
Hello @Jack_DB
Please refer to the article below to debug your Hard fault:
How to debug a HardFault on an Arm® Cortex®-M STM3... - STMicroelectronics Community
2025-11-14 8:23 AM
Connecting GND shouldn't cause a hard fault. If there is a voltage difference between the GND of the two boards, why? How are they connected? USB gnd is generally tied to earth ground, or isolated. Shouldn't be a problem there.
2025-11-14 8:26 AM
>>Just to make sure, you confirm that connecting the grounds is required?
Yes, how the electrons flow...
Now you might implicitly achieve this via the USB connector to a common computer, but you are just creating a longer and potentially more difficult path to complete the circuit.
Solve the Hard Fault, it's a gross error and suggest other latent issue in your code. Perhaps getting a lot of interrupts and you incrementing through the end of a buffer. ie buffer[i++] = char, where 'i' is unbounded.
2025-11-14 8:31 AM - edited 2025-11-14 9:36 AM
As always, don't try to do both ends of the link at once !
Get each part working independently, tested against a known-good reference, before bringing them together.