I've learned that, when debugging a code that utilizes USART, we can't do it over the ST-LINKV2 on the Disco board.
I found that to achieve this we have to use a usb-to-serial converter. I have the PL2303HXA and i'm using it on my disco with the STM32F407VGT6 MCU. I've tried something but i can't debug. I've also considered the cross connection: tx(converter) - rx(mcu), rx(converter) - tx(mcu), and connected the common grounds and tried both 5V and 3.3V VCC, but still no result.
These are the connections i made:
Note: Here i have the LED1 blinking red (toggling), and when i try to debug like this it says: No ST-LINK detected and this one:
The other thing i did is this:
Here i connected the Mini USB to another usb port on my pc, and the PL2303HXA in another as can be seen.
Here i only get the error: Error: Flash Download failed - "Cortex-M4"
You can't "debug" the device via USART. Your application can send data via this USART and with the serial to USB adapter you can use for example a terminal program on your PC to watch the output if your application sends ASCII chars.
Using the uVision Debugger works via the onboard ST-Link. And to verify, that your board is working, disconnect the USART cables. Connect the mini USB cable, which connects the onboard ST-Link to the PC. Can you then flash the device and start a debug session with it?
If flashing still fails, are there additional output messages in the Build Window, that tell more about possible failure reasons?
Else, if flashing and debugging works then, only connect the data (TX and RX) cables and GND. As the board has a power supply via the ST-Link another power supply is not needed.
Flashing and debugging works fine and i connect the TX and RX cables and GND and thereby connect my board with the usb-to-serial adapter but i don't see any text displayed in TeraTerm.
So the board is ok. But why you don't see output on the PC is difficult to comment. Possible reasons range from "your STM32 program does not output any data on the USART2" to " the wrong COM port is selected in Tera Term". So far, this is only something you can check yourself.