Page 1 of 1

[Help]How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Fri Jan 03, 2020 5:54 am
by HIDDEN
I am having some problems to configure these pins as inputs because they share other predefined functions at boot.

In the case of PA15 I have disabled the JTAG function so that it isn't used as JTDI. When I try to use it as input, it remains in activated state all the time. Doesn't matter if I set it as a floating, pull-up or pull-down input. Other JTAG pins as PB3 or PB4 work correctly.

PC13, PC14 and PC15 pins do act as inputs as they change state but they do in a strange way, toggling constantly as if they were connected to a clock that was causing this behavior.

I am using a blue pill, so I don't know if this behavior is due to the interference of the 32.768 Khz oscillator connected between PC14 and PC15 or LSE is not properly disabled. Do I need to desolder this oscillator to use the inputs correctly?

I would be grateful if someone who has managed to handle these pins correctly guides me on how to correctly configure the use of these pins as GPIO if possible for Libmaple core.

Re: How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Fri Jan 03, 2020 6:45 am
by ag123
for the blue pill there is a on board 32k crystal, so it feeds at 32khz. more commonly. it is useful for rtc as the lse
connect a coin cell at vbat, and the rtc keep running for months
https://www.aliexpress.com/wholesale?ca ... maple+mini
the maple mini boards are those that do not have the 32khz crystal and caps soldered, but those pins
still have the oscillatory circuits as it is intended for that purpose
it may still be possible to use it with the 32khz signals for input, just that the processing'd be more complicated than simply reading a pin
e.g. to try to minus lse signals etc

Re: [Help]How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Tue Jan 28, 2020 9:03 am
by Pito
Those pins have some limitation - speed and fanout (they are weaker).
It was discussed how to enable them on the old forum many times.
https://stm32duinoforum.com/forum/index_php.html

I think the pins with 32kHz resonator should work when oscillator disabled. Mind there are capacitors to the ground, and, between the pins (the resonator) thus they may interfere each other.

Re: [Help]How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Tue Jan 28, 2020 3:04 pm
by stevestrong
As @ag123 said, there is a crystal on PC14/15, so you will most probably not be able to use them as input, unless you remove the crystal.
On PC13 there is a LED tied to 3.3V via a resistor, so you have to have a small signal impedance if you want to use it as input. Or remove the LED.
PA15 should work as input if you call in setup:

Code: Select all

disableDebugPorts();

Re: [Help]How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Tue Feb 04, 2020 1:19 am
by HIDDEN
Thank you very much for the answers. I will try to desolder the crystal to verify that the inputs work correctly. As for PA15, I have set up as stevestrong says, but for some reason it still doesn't work as input. Keep investigating.

Re: [Help]How to configure PA15 PC13 PC14 PC15 as inputs on Libmaple core

Posted: Tue Feb 04, 2020 8:54 am
by stevestrong
Post a simple sketch which shows that PA15 does not work as (digital) input.