0
\$\begingroup\$

Specifically, an STM32F051 has some limitations on pins also used for the 32 kHz "LSE":

  1. PC13, PC14 and PC15 are supplied through the power switch. Since the switch only sinks a limited amount of current (3 mA), the use of GPIOs PC13 to PC15 in output mode is limited:
    • The speed should not exceed 2 MHz with a maximum load of 30 pF.
    • These GPIOs must not be used as current sources (e.g. to drive an LED).
  2. After the first RTC domain power-up, PC13, PC14 and PC15 operate as GPIOs. Their function then depends on the content of the RTC registers which are not reset by the main reset. For details on how to manage these GPIOs, refer to the RTC domain and RTC register descriptions in the reference manual.

This seems to mean that these pins can only sink a combined 3 mA, so they must be configured as open drain only, not as push-pull?

The reference manual says

When PC13 is not used as RTC alternate function, it can be forced in output push-pull mode by setting the PC13MODE bit in the RTC_TAFCR. The output data value is then given by the PC13VALUE bit. In this case, PC13 output push-pull state and data are preserved in Standby mode. The output mechanism follows the priority order shown in Table 80. When PC14 and PC15 are not used as LSE oscillator, they can be forced in output push-pull mode by setting the PC14MODE and PC15MODE bits in the RTC_TAFCR register respectively. The output data values are then given by PC14VALUE and PC15VALUE. In this case, the PC14 and PC15 output push-pull states and data values are preserved in Standby mode. The output mechanism follows the priority order shown in Table 81 and Table 82.

The tables then show that with the respective bits set to zero the pin is a "Standard GPIO".

RTC_TAFCR then probably should be reset manually (before?) trying to configure it as GPIO output?


What are the implications for using it as an output, e.g. with an external mosfet - does this then have to be a p-channel with a pull-up resistor on its gate? As an input it could be used regularly, except that it's not five-volt tolerant?

\$\endgroup\$
  • 1
    \$\begingroup\$ Where are you getting the idea that it cannot be operated push-pull from? Your quote says not to use it for LED-scale currents, but it doesn't say anything about polarity. It does not appear to be using "source" vs "sink" in any precisely meaningful way, but you can probably get specific directional numbers from the ratings table. \$\endgroup\$ – Chris Stratton Mar 17 '18 at 14:18
  • \$\begingroup\$ BTW, PC13 is used for LED on blue pill (STM32duino) board wiki.stm32duino.com/index.php?title=Blue_Pill \$\endgroup\$ – josip Mar 17 '18 at 15:43
  • 1
    \$\begingroup\$ @josip the Blue Pill has an entirely different kind of MCU \$\endgroup\$ – berendi Mar 17 '18 at 16:06
  • \$\begingroup\$ @ChrisStratton It specifically says not to source current which is "pushing", is it not? So while it might be possible to configure the pin as push-pull output, that implies it's "forbidden" . Unfortunately I could not find any further details in the datasheet or elsewhere, hence this question :-) \$\endgroup\$ – handle Mar 19 '18 at 9:21
  • \$\begingroup\$ No, it does not say that. What it does is caution you against using it to drive a current-mode load like an LED, because most LEDs would need current in excess of what it is rated for. \$\endgroup\$ – Chris Stratton Mar 19 '18 at 15:44

Your Answer

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

Browse other questions tagged or ask your own question.