2024-09-13 01:30 AM
How do I connect 2 mcu stm32 nucleo l053r8 boards using uart with only one USB cable and how do I check if connection is established using led
2024-09-13 01:38 AM
How exactly would this work?
The ST-LINK is not implementing a USB Host.
Why wouldn't you just connect up a UART more directly?
On the PC side you could write an app to move data between COM ports at the ST-LINK level.
2024-09-13 02:05 AM
Hi @Desireee
I may suggest using USB UART bridges to send and receive data. Here is an example
Configure the USB OTG peripheral on the Host board to operate in Host mode.
Configure the USB OTG peripheral on the Device board to operate in Device mode.
Implement data or file transmission (Host to Device) and data reception (Device to Host) through CDC class.
Ensure the USB device is configured correctly in the usbd_cdc_if.c file then use CDC_Receive_FS function to handle received data through the Hyperterminal.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-09-13 03:01 AM - edited 2024-09-13 03:26 AM
@Desireee wrote:connect 2 mcu stm32 nucleo l053r8 boards using uart with only one USB
What do you mean by that?
The only USB connection on the Nucleo-L053R8 is the ST-Link - you cannot connect those directly together!
As @Tesla DeLorean said, if you want a UART connection, just wire between the UART pins on the Arduino and/or Morpho connectors:
Check the Datasheet for UART pin assignments:
https://www.st.com/en/microcontrollers-microprocessors/stm32l053r8.html#documentation
Note that the ST-Link's VCP connects to PA2 and PA3 - so you'll have to disconnect that to use those pins.
@Desireee wrote:how do I check if connection is established using led
But don't start by trying to do this all at once - a common beginner's mistake.
Instead, take it one simple step at a time:
In this case, start by testing your serial comms against a terminal on a PC.
Only connect the two boards together once you know that both your receiving and transmitting code is fully working and debugged.
Don't try to do both ends at once:
https://community.st.com/t5/stm32-mcus-boards-and-hardware/i2c/m-p/668411/highlight/true#M18743
2024-09-13 03:19 AM
@FBL wrote:Configure the USB OTG peripheral on the Host board to operate in Host mode.
Configure the USB OTG peripheral on the Device board to operate in Device mode.
But the STM32L053R8 (the device on the Nucleo-L053R8) doesn't have OTG - it's Device only:
2024-09-13 04:29 AM
How many USB Cable do I need to upload the code? As I'm a beginner I do not know how to establish connection between 2 mcu boards. What I did for now is only connecting Tx-->Rx , Rx-->Tx and random 2 ground from each board connect together using manual connection
2024-09-13 05:37 AM - edited 2024-09-13 05:38 AM
@Desireee wrote:How many USB Cable do I need to upload the code?
One per board.
If you do one board at a time, then just one cable.
@Desireee wrote:What I did for now is only connecting Tx-->Rx , Rx-->Tx and random 2 ground from each board connect together using manual connection
That's correct - and not specific to STM32:
https://learn.sparkfun.com/tutorials/serial-communication/all
Again, as a beginner, don't jump straight into trying to do this all at once - take just one small, simple step at a time.
As per the previous link:
See this thread for more learning resources - with a focus on STM32:
Some links here on testing/debugging serial comms: