0
\$\begingroup\$

Custom board, not an ST development board.

MCU: STM32G031J6M6 SO8 package. UART RX/TX are Pins 1 and 8 respectively.
Pin 8 is also SWDCLK
Pin 7 is SWDIO and not used except for SWD
NRST is Pin 4 and has an internal pull-up.

From reading the option bytes via the STM32 CubeProgrammer. All the options are checked by default, including nBOOT_SEL, nBOOT1, nBOOT0 and NRST_Mode is 3. The BOOT_LOCK is unchecked (0) With this configuration it appears the MCU is booting straight into flash memory as intended.

I am able to flash the firmware and also run the program successfully.
But the successful running is only with the STLink utility connected to the board. If it's not connected, there's some random gibberish characters being displayed on the terminal along with my own input as i type into the keyboard.
e.g. if i type 'ACTION', i will see 'AACTION??$d', etc.
The input is clean when the STLink is connected.

If I disconnect the STLink and reconnect it, the program no longer seems to work (at least I am unable to track where it is in its execution state), I have to then do a power reset with the STLink connected and it's functional again. The firmware is a 'Release' build.

In the main loop, I just added a block of code to continually print 'hi\n' so it seems the UART init is OK even without the STLink connected, and it prints hi continuously except for those random gibberish characters turning up sometimes along with the hi. The gibberish seems more persistent when I'm typing, almost like an echo.

I have an FTDI (original not fake) TTL-232R serial convertor connected to the board and back to the PC via USB on the same USB bus as the STLink debugger. I am only using the GND, TX, and RX pins.

FTDI TTL-232R Serial Convertor

STM32 UART Connection

\$\endgroup\$
0

1 Answer 1

5
\$\begingroup\$

I would verify that you have a good ground from the DUT to the FTDI converter cable. You could have a situation where the ST-Link is ground referencing your system to the host PC.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ It was this...the GND pin connection of the header I had on the board for the FTDI connector was questionable, only buzzed to the multimeter at the tip of the pin. Re-soldered and it works. Not the first time that I've wasted days over bad solder joints. Thank you! \$\endgroup\$
    – Usernamed
    Dec 3, 2021 at 19:55
  • \$\begingroup\$ Great! Glad to help! Happens to the best of us \$\endgroup\$
    – Luke Gary
    Dec 3, 2021 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.