Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years ago.
Reading the temperature sensor and the internal voltage reference
Is it possible to use AnalogIn() or some other high level API to read the temperature sensor, or do I need to access the registers directly? AnalogIn() takes a pin name as a value, but there are no pins for the temp sensor and VREFINT.
Question relating to:
1 Answer
10 years ago.
The ST processors have a internal temp sensor connected to the ADC. You can use the cmsis interface. Much easier than direct register access. Load the mbed-src lib and look into stm32f0xx_adc.c There you can find ADC_TempSensorCmd(ENABLE); ...
Which temp sensor do you plan to use ? I use LM35 and LM60 using analogIn(AnalogPin) and it works. I used Nucleo and FRDM. Both gave me the correct temp reading.
HTH
posted by samira samilan 01 Apr 2014I plan to use the STM32F030R8T6's internal temp sensor. It is connected to ADC Channel 16.
posted by Pekka Ahmavuo 02 Apr 2014I decided to publish an example of how to do this. I am working on a mod that will simplify the declarations within mbed and make it more user friendly. My code is here: https://developer.mbed.org/users/sixBase3/code/Nucleo_read_analog_value_intADCch/
posted by Bill Bellis 31 Mar 2016