2021-09-09 11:10 PM
Hello,
I need use ANA0 and ANA1 as ADC because HW engineer connect ADC signal to those pins. But I don't konw how to config the devicetree. I think ANA0 and ANA1 pin are special pins. Please help me, Thank you.
Shaw.
Solved! Go to Solution.
2021-09-09 11:59 PM
Hi,
please see https://wiki.st.com/stm32mpu/wiki/ADC_device_tree_configuration#DT_configuration_-28board_level-29
As ANA0 and ANA1 are directly connected to ADC input pins, there is no need of pinmux setting for those inputs.
ANA0 is directly connected to both ADC1 in0 and ADC2 in0
ANA1 is directly connected to both ADC1 in1 and ADC2 in1
So, a DT example using ANA0 on ADC1 and ANA1 on ADC2:
&adc {
/* ADC1 & ADC2 common resources */
pinctrl-names = "default";
vdda-supply = <&vdda>; /* Example to supply vdda pin by using a PMIC regulator */
vref-supply = <&vrefbuf>; /* Example to use VREFBUF (It needs to be enabled as well) */
status = "okay"; /* Enable ADC12 block */
adc1: adc@0 {
/* private resources for ADC1 */
st,adc-channels = <0>; /* ADC1 in0 channel is used */
st,min-sample-time-nsecs = <10000>; /* 10µs sampling time */
status = "okay"; /* Enable ADC1 */
};
adc2: adc@100 {
/* private resources for ADC2 */
st,adc-channels = <1>; /* ADC2 in1 channel is used */
st,min-sample-time-nsecs = <10000>; /* 10µs sampling time */
status = "okay"; /* Enable ADC2 */
};
};
If there is other ADCx_IN channels used on regular GPIOs pins, a pinmux will then be required for those pins (which need ADCx_PCSEL setup).
Regards.
Patrick
2021-09-09 11:59 PM
Hi,
please see https://wiki.st.com/stm32mpu/wiki/ADC_device_tree_configuration#DT_configuration_-28board_level-29
As ANA0 and ANA1 are directly connected to ADC input pins, there is no need of pinmux setting for those inputs.
ANA0 is directly connected to both ADC1 in0 and ADC2 in0
ANA1 is directly connected to both ADC1 in1 and ADC2 in1
So, a DT example using ANA0 on ADC1 and ANA1 on ADC2:
&adc {
/* ADC1 & ADC2 common resources */
pinctrl-names = "default";
vdda-supply = <&vdda>; /* Example to supply vdda pin by using a PMIC regulator */
vref-supply = <&vrefbuf>; /* Example to use VREFBUF (It needs to be enabled as well) */
status = "okay"; /* Enable ADC12 block */
adc1: adc@0 {
/* private resources for ADC1 */
st,adc-channels = <0>; /* ADC1 in0 channel is used */
st,min-sample-time-nsecs = <10000>; /* 10µs sampling time */
status = "okay"; /* Enable ADC1 */
};
adc2: adc@100 {
/* private resources for ADC2 */
st,adc-channels = <1>; /* ADC2 in1 channel is used */
st,min-sample-time-nsecs = <10000>; /* 10µs sampling time */
status = "okay"; /* Enable ADC2 */
};
};
If there is other ADCx_IN channels used on regular GPIOs pins, a pinmux will then be required for those pins (which need ADCx_PCSEL setup).
Regards.
Patrick
2021-09-21 02:21 AM
Hi @xkun.1
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
Thanks,
Kevin