cancel
Showing results for 
Search instead for 
Did you mean: 

Internal temperature reading and DAC output

LFu.1
Associate II

I am trying to get the temp of the internal temp sensor.. I tested on both MB1367 demo board and my own board.I use jumper to connect JP8 pin2 and pin 3 to get Vref as 3.3V. I attached the cubmx and main file of my simple code. The issue is I always get 0x360~0x366. The factory number is around 0x055f at 30C degree at 3.0V. So That is far away from the correct the temp. The ambient temp is not possible to negative degree. I even tested on G474 board. Also get the same number.

In the main.c , "temp_value" is the variable I am using to read the temp value.

After that ,I test DAC on MC1367.Vref+ is also 3.3V. When I setup HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 4095); I also get 3.23v instead of 3.3V from PA4.

Question :

  1. why cant' I get the correct temp value?
  2. Why does the DAC has that much difference?

I need Urgent help!

Thanks,

Li

6 REPLIES 6
TDK
Guru

The chip temperature will be considerably above ambient.

What does 0x360-0x366 translate to in terms of temperature?

Also ensure the sample time is sufficient per the datasheet. If in doubt, use the max sample time.

If you feel a post has answered your question, please click "Accept as Solution".
LFu.1
Associate II

It translates to -29 degreeC. I also try the maximum cycle time as well. Same value.

LFu.1
Associate II

Do you have sample code and cubemx I can use directly?

Do you perform calibration before measurement? Do you decouple properly VREF? Have you tried slower ADC clock? Have you tried to disable the other ADC? Have you read the ADC chapter in RM, the available appnotes, the Errata?

https://community.st.com/s/question/0D50X0000C9fujq/stm32g4-adc-clock-frequency-limitations

JW

On STM32, DAC output notoriously does not go rail to rail, especially if the buffer is on. See the respective values in datasheet.

JW

LFu.1
Associate II

Thanks for solving issue for me. ?Finally, I figured out. It should be getvalue()*3.3V/3.0V. I did reverse. But I did found another thing. I get the temp CAL values which are 1042 on 30 degree and 1375 on 110 degree. Then I get the slope is 3mv/C. The datasheet says the maximum slope is 2.7 mV/C. Should have another Errata?