Skip to main content
Rogers.Gary
Senior II
May 17, 2017
Question

STM32F4 Temperature Function With I/O on PC6

  • May 17, 2017
  • 11 replies
  • 2079 views
Posted on May 17, 2017 at 07:27

Hello:

Question 1:

A question that I cannot find an answer for. If I'm using PC6 (STM32F4) as a GPIO already, can I still configure and use the internal temperature sensor on ADC16?

Question 2:

Using the calibration constants stored in the device, and adding some extra calibration points if required, how accurate is the temperature sensor at ranges of -40C to +70C ?

Thanks...

Note: this post was migrated and contained many threaded conversations, some content may be missing.
    This topic has been closed for replies.

    11 replies

    AvaTar
    Senior III
    May 17, 2017
    Posted on May 17, 2017 at 07:58

    The internal temperature is a separate channel (ADC1_IN16 on a F40x), i.e. connected to a separate ADC MUX input. You don't need (and cannot use) a GPIO for it.

    For accuracy, the reference manuals says +-1.5°C. I never tested that, though.

    It is obviously based on the forward voltage measurement of a p-n junction on the die.

    See the reference manual (DM00031020, DocID018909) for details.

    Rogers.Gary
    Senior II
    May 17, 2017
    Posted on May 17, 2017 at 08:17

    Hi, thanks for this. What I meant by the question is, can I *also* use a GPIO at the same time?

    AvaTar
    Senior III
    May 17, 2017
    Posted on May 17, 2017 at 08:50

    Yes.

    The temperature sensor is not associated with any 'alternate function' of a GPIO pin.

    What is true, you can't use a pin as GPIO and as ADC input channel at the same time. But that is true for any other alternate function as well.

    BTW, you have not specified which MCU you talking about. On a F407 (on the F4 Disco board), PC6 has no analogue alternate function.

    Rogers.Gary
    Senior II
    May 17, 2017
    Posted on May 17, 2017 at 15:52

    Hi, sorry, it should have been written. It is the STM32F405VG / 100 pin device.

    To clarify, I want to use an already assigned GPIO (control a relay) to PC6, but add the ability to measure temperature on ADC16 (PC6)

    I noticed that in configuring the temperature sensor, it did not assign using the normal 'AF' call, and thus my question.

    So it DOES appear it can be done on this device then? If so, that's terrific.

    Thanks so much for your help.