Skip to main content
Visitor II
July 22, 2022
Solved

Inaccurate measurement of VREFINT

  • July 22, 2022
  • 3 replies
  • 3154 views

Hi everyone!

I see unexpected values when measuring VREFINT. The ADC measures around 1.18V, on some boards even 1.16V, which is outside the tolerance according to the datasheet:0693W00000QLsweQAD.png 

Reading the calibration value VREFIN_CAL from OTP memory returns a value of 0x5E29 (1,214V).

Considering my ambient temperature of ~25°C, I would not expect the measured value to differ too much from VREFINT_CAL.

I then used VREFIN_CAL to calculate VREF+ according to section 29.4.35 in RM0436:

0693W00000QLsozQAD.pngWith the ADC-measurement of VINTREF, this calculates to VREF+= 2.57V. The actual voltage (measured with a multimeter) is 2.502V.

All the other ADC channels are pretty accurate.

My DeviceTree setup for ADC2:

adc2:adc@100{
	st,adc-channels = <12 13 14>;
	st,min-sample-time-nsecs = <50000>;
	assigned-resolution-bits = <16>;
	status = "okay";
	channel@12 {
		reg = <12>;
		label = "vsense";
		status = "okay";
	};
	channel@13 {
		reg = <13>;
		label = "vrefint";
		status = "okay";
	};
	channel@14 {
		reg = <14>;
		label = "vddcore";
		status = "okay";
	};
};

    This topic has been closed for replies.
    Best answer by PatrickF

    sorry there is typo in the wiki, "min-sample-time-nsecs" is ok.

    We are checking internally, but meanwhile, could you try putting sample time defintion inside each channel ?

    e.g.

     adc2:adc@100{
     	st,adc-channels = <12 13 14>;
     	assigned-resolution-bits = <16>;
     	status = "okay";
     	channel@12 {
     		reg = <12>;
     		label = "vsense";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     	channel@13 {
     		reg = <13>;
     		label = "vrefint";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     	channel@14 {
     		reg = <14>;
     		label = "vddcore";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     };

    Regards.

    3 replies

    Technical Moderator
    July 22, 2022

    Hi @jvog.sen​ 

    maybe a typo in your DT which end up to a too short sample time (as per datsheet should be above 4.3us for VREFINT)

    min-sample-time-nsecs ==> min-sample-time-nsec (assuming you are on Ecosystem v3.1)

    See also https://wiki.st.com/stm32mpu/wiki/ADC_device_tree_configuration#Channel_properties_-28for_ecosystem_release_-E2-89-A5_v3-1-0_-29

    Regards.

    PatrickFAnswer
    Technical Moderator
    July 22, 2022

    sorry there is typo in the wiki, "min-sample-time-nsecs" is ok.

    We are checking internally, but meanwhile, could you try putting sample time defintion inside each channel ?

    e.g.

     adc2:adc@100{
     	st,adc-channels = <12 13 14>;
     	assigned-resolution-bits = <16>;
     	status = "okay";
     	channel@12 {
     		reg = <12>;
     		label = "vsense";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     	channel@13 {
     		reg = <13>;
     		label = "vrefint";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     	channel@14 {
     		reg = <14>;
     		label = "vddcore";
     	 st,min-sample-time-nsecs = <50000>;
     		status = "okay";
     	};
     };

    Regards.

    jvog.senAuthor
    Visitor II
    July 22, 2022

    Hi Patrick,

    Thanks for the quick response. I will try this next week!

    Regards

    Jan

    Technical Moderator
    July 25, 2022

    Hi @jvog.sen​ 

    Please confirm you are using ecosystem v3.1 (Linux kernel 5.10) or v4.0 (Linux Kernel v5.14) ?

    Regards.

    jvog.senAuthor
    Visitor II
    July 27, 2022

    Hi Patrick,

    I am currently using ecosystem v3.1.

    Regards

    Jan