2023-03-14 07:31 AM
I have an STM32F4 Discovery board with a USB->Serial converter connected to pins PA2 (TX) and PA3 (RX). I used CubeMX to configure usart2. My test code successfully sends data over usart2 when I power the discovery board as usual over USB.
However when I connect an external 5v power source and GND to the Demo board's GND and +5V inputs, data successfully sends over usart2 but data becomes only random characters when I disconnect the USB cable. It seems the Demo board's usart2 is affected when the ST-Link2 USB cable is disconnected. The code seems to run ok, and the only part affected seems to be the serial connection over usart2.
Is this expected? Is the Demo board's firmware sending data over usart2 in order to establish a lost connection to ST-Link? Are pins PA2 and PA3 internally connected to the same as ST-Link serial port or debugger uses?
UPDATE: This issue was caused by a bad ground from the USB->Serial converter to the uC.