I’m having issues with analog reading on a FX30.
In order to read the ADC value I’m using /sys/class/hwmon/hwmon0/device/mpp_05.
Firstly, I’m unable to select the range between 0-5V or 0-10V.
From the documentation “41110030_FX30 Hardware User Guide_r1.pdf” (page 38), it should be possible to select the ADC range through AT commands but running these commands fails:
modem /dev/ttyAT 230400 “AT!FWD=GPIOCFG,25,OUT”
Same for modem /dev/ttyAT 230400 “AT!BSGPIO=25,1,0”
The document 41110030_FX30 User Guide_r2.pdf may be a better more up to date version but it describes the range without indicating how to set it.
I also tried to manually configure GPIO25 this way:
echo out > /sys/class/gpio/gpio25/direction
echo 1 > /sys/class/gpio/gpio25/value
This gives no error, but there’s no change in what /sys/class/hwmon/hwmon0/device/mpp_05 reports.
A second issue is that the range of raw values seems to be compressed: at 0V the raw value is 24808, while at 5V the raw value is 42750. This makes a range of 17942, which is quite far from the theoretical range of 32768 (15 bits).
At page 22 of the user guide, the table says that the analog input is connected on I/O 2 on the power connector, together with GPIO21. Manually disabling pull up on GPIO21 didn’t change anything (echo down > /sys/class/gpio/gpio21/pull)
Firmware version: SWI9X15Y_07.11.22.00 r33729 CARMD-EV-FRMWR1 2017/01/11 18:04:06 (as reported by modem /dev/ttyAT 230400 “AT+GMR”)
Is there additional configuration switches to manage the analog input ?
Thanks in advance