Skip to main content
NSharp
Associate II
August 23, 2019
Question

STMF0 Possible to use both USART2 RX and SYS_SWCLK pins simultaneously?

  • August 23, 2019
  • 1 reply
  • 1031 views

I would like to be able to use USART2 in RX mode only, but even configuring it as Receive only still takes over the SYS_SWCLK pin (with alternate function USART2 TX). I am never going to use the TX pin, and I'd like to use SYS_SWCLK for flashing and debugging. STM32CoreMX doesn't seem to allow this configuration. Configuring USART2 will setup the pins and options; but, then changing the SYS_SWCLK pin from TX to SWCLK reverts all the USART2 setup.

How can I have my cake and eat it, too? :)

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
August 23, 2019

Stop relying on CubeMX and do it manually. Check there isn't any stupidity in the MSP file setting up the PA14 (SWCLK) pin, you should just be able to set up PA15 and USART2 in RX mode

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
NSharp
NSharpAuthor
Associate II
August 23, 2019

Thank you for your reply - the STM32 architecture and tools are relatively new to me and is what STMicro is pushing for configuration. My previous workaround has been to configure everything as USART2 in CubeMX. Then, go in and remove PA14 from any of the initialization. I guess that's the way forward. Every pin is unique in its alternate function, correct? So, the TX/RX pins are not functionally tied together, unless they are initialized together, right?

Tesla DeLorean
Guru
August 23, 2019

The F0 has a pretty flexible pin function mux. The F1 series moved peripheral pins in blocks, and was a headache.

You should be able to configure the RX independent of the TX, whether enabled, or onto an entirely different pin (PA2 or whatever)

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..