Tool/software: Linux
Hi,
I am using am3352 with linux 4.14. I need to check the voltage on analog line, e.g. the voltage usb0 and some others. Is there a convenient way of getting the value by software?
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
Hi,
I am using am3352 with linux 4.14. I need to check the voltage on analog line, e.g. the voltage usb0 and some others. Is there a convenient way of getting the value by software?
Thanks.
Hi Yingjie,
Could you please provide more details regarding your request. Do you need to check a AM335x device pin voltage value by Software?
Regards,
Pavel
Hi Pavel,
I need to get the value of AIN0-AIN3 by software. The value on these pins is voltage from different source in our am3352 board.
Hello Yingjie,
If you want to read voltage values on the ADC input pins, take a look at our Kernel driver ADC documentation.
Regards,
Nick
One note: please make sure that the input voltage to the ADC pins is always 1.8V or lower. If you try connecting a higher voltage to the ADC input pins, then you could damage your processor. Do NOT connect a 5V USB signal directly to your ADC pins, because you will damage your part.
Regards,
Nick
Hi Nick,
I enabled ADC driver in config file and edited dts as suggested.
After the system boot up, all in_voltagex_raw is 4095, and scan_elements/in_voltagex_en are all 0.
The CONFIG is as following:
CONFIG_MFD_TI_AM335X_TSCADC=m
CONFIG_IIO=m
CONFIG_IIO_BUFFER=y
CONFIG_IIO_KFIFO_BUF=m
CONFIG_TI_AM335X_ADC=m
The dts files are as following:
In am33xx.dtsi:
tscadc: tscadc@44e0d000 {
compatible = "ti,am3359-tscadc";
reg = <0x44e0d000 0x1000>;
interrupts = <16>;
ti,hwmods = "adc_tsc";
status = "disabled";
dmas = <&edma 53 0>, <&edma 57 0>;
dma-names = "fifo0", "fifo1";
am335x_adc: adc {
#io-channel-cells = <8>;
compatible = "ti,am3359-adc";
};
};
In am335x-myboard.dts :
&tscadc {
status = "okay";
adc {
ti,adc-channels = <0 1 2 3 4 5 6 7>;
};
};
How can I enable these pins?
Thanks.
Hello Yingjie,
Please clarify on what you mean by "How can I enable these pins?".
As per our ADC Linux driver documentation, I would expect that cat /sys/bus/iio/devices/iio\:device0/in_voltageX_raw should give 4095 if you have 1.8V connected to the pins, and a lower value if you have a lower voltage connected to the pins.
Take a look at the "How to set it up" section of the ADC documentation for guidance on how to set in_voltageX_en when you are reading ADC data continuously.
Regards,
Nick
Thanks Nick,
The resistors on board are wrong. After changing it, now I got correct value.