AnsweredAssumed Answered

Configuring SWCLK pin as an Input PullUp rather than the default Input PullDown

Question asked by Nick Smith on Mar 26, 2014
Hi all, your thoughts on this would be appreciated.

I have a need to re-configure the SWCLK pin on the STM32F103C8 (PA14) as an input with pull-up. By default on power up it is input puul-down. I still intend to use as SWCLK for my SW Debug.

I tried reprogramming the GPIOA_CRH and GPIOA_ODR registers to set this, but it had no affect on what the pin physically did.

As an experiment, I changed the MAPR to completely disable JTAG, thus release PA14. Now, changing GPIOA_CRH and GPIO_ODR correctly affects what the pin does.

OK, so I can accept that whilst the JTAG is enabled, that modifying the PulUp/PullDown status may not take affect, but what is strange is that if I:
Disable JTAG
Set PA14 as Pull Up
Re-enable JTAG
then the SWCLK pin retains the state I re-programmed it to.
Indeed after this sequence I can change the mode of the pin as I wish.

So taking this one step further i tried
Disable JTAG
Re-enable JTAG(SWD only)
Modify PA14 input mode
and this works as expected.

So it appears you have to disable jtag, then re-enable before you can modify the input mode of the pin.

This seems very odd does it not?

EDIT
Have now realised that disabling the JTAG pins then re-enabling the SWD pins doesn't work - it appears theat when I do this, the SWD interface is non functional (unless the SWD tries to communicate wilst NRST is active, which I cannot do). Almost as if once you turn the pins off, they remain off until reset!

Nick

Outcomes