I have developed an stm32L based application using Arduino IDE. I need to debug the code. How to define USART2 (RX, TX) to communicate via a USB-TTL converter?
Thanks for your kind help
Serial monitor
Serial monitor
1. your USB-TTL adapter might be faulty
2. you have wrong driver for your adapter
3. there is a program on your PC that connects automatically to any available COM port.
Go to full post2. you have wrong driver for your adapter
3. there is a program on your PC that connects automatically to any available COM port.
Re: Serial monitor
Just define HardwareSerial object and use it same as "standard" Serial (eg. Serial1.write(), Serial1.print())
https://github.com/stm32duino/wiki/wiki ... wareserial
https://github.com/stm32duino/wiki/wiki ... wareserial
Re: Serial monitor
Thanks a lot, Gozog!
I did as you mentioned in a simple code for STM32L433 as follows:
However, I receive the following error message:
What is the reason for the port to be busy?
I did as you mentioned in a simple code for STM32L433 as follows:
Code: Select all
// RX TX
HardwareSerial Serial2(PA15, PA2);
void setup() {
Serial2.begin(115200);
}
void loop() {
Serial2.println("Hello World!");
delay(1000);
}
Code: Select all
Error opening serial port 'COM21'. (Port busy)
Re: Serial monitor
It's exactly what it's written there: "Port busy" - something is using it.
And it has nothing to do with MCU. This COM port is your USB-TTL adapter.
And it has nothing to do with MCU. This COM port is your USB-TTL adapter.
Re: Serial monitor
I have nothing else than the USB-TTL adapter which is connected to the following pins on my board:
When I change the port number via 'Device manager', I still receive a similar error with the new port number!
what might be the solution? changing the port number to any specific one or what?
I even closed Arduino IDE and used putty to see if it helps to bypass the port busy issue. But it didn't help. There is nothing else left to close or disconnect!
As you mentioned, USB-TTL is using the same port number. On the other hand, we use this device to see the same serial port. It is confusing to know what to do.
Code: Select all
3.3V
GND
TX-->RX2 or TX2
RX-->TX2 or RX2
what might be the solution? changing the port number to any specific one or what?
I even closed Arduino IDE and used putty to see if it helps to bypass the port busy issue. But it didn't help. There is nothing else left to close or disconnect!
As you mentioned, USB-TTL is using the same port number. On the other hand, we use this device to see the same serial port. It is confusing to know what to do.
Last edited by mebab on Sat Jan 22, 2022 9:45 pm, edited 1 time in total.
Re: Serial monitor
The COM port you see on your computer has nothing to do with your STM board.
It's an USB-TTL adapter and computer connects with this adapter, not MCU.
If you cannot open COM port, then something on your PC is using this port.
It's an USB-TTL adapter and computer connects with this adapter, not MCU.
If you cannot open COM port, then something on your PC is using this port.
Re: Serial monitor
Sorry! I changed the port number of the USB-TTL adapter to many others via 'Device manager'. However, it didn't help. Whatever free port number I assign, is represented busy by Arduino IDE or Putty. I don't know what is left to do!
Re: Serial monitor
1. your USB-TTL adapter might be faulty
2. you have wrong driver for your adapter
3. there is a program on your PC that connects automatically to any available COM port.
2. you have wrong driver for your adapter
3. there is a program on your PC that connects automatically to any available COM port.
Re: Serial monitor
Thank you GonzoG!
I updated the firmware of the USB-TTL adapter and the problem is solved now.
Thanks again,
Mehrdad
I updated the firmware of the USB-TTL adapter and the problem is solved now.
Thanks again,
Mehrdad