> Have an Overo Fire FE running the following kernel built with Yocto:
> Linux <hostname> 3.5.0 #1 PREEMPT Tue Dec 18 02:25:50 EST 2012 armv7l
> For some reason the ADC channel 3 is returning a strange value:
> # cat /sys/class/hwmon/hwmon0/device/in3_input
> This is supposed to be the mV value read on pin 3 of ADC. We have checked
> the value of the Tobi headers for this channel and it is around 2000 mV.
> Any ideas on why we are reading such a low value?
> Let me know if you need any more information to help diagnose this issue.
Do you have anything connected to the USB otg port when you read the
ADC? If no, then plug something into that port and then re-read your
ADC. If you now get the expected value, then your problem is as follows:
If nothing is connected to the USB OTG port, the phy suspension code is
called. In the chain of calls that follows, the vusb3v1 regulator is
disabled. However, according to the OMAP power management manual,
vusb3v1 is used "to bias the analog multiplexers on the four MCPC pins
between the carkit and the MADC". I've seen if there is no bias on this
mux, the MADC driver returns incorrect counts on these 4 pins that
should be in A/D mode. If I plug something into the USB OTG port, the
MADC driver returns the expected counts. I also created a debug version
of the twl4030-usb driver, with the disabling of the vusb3v1 commented
out and the MADC returns the correct counts regardless of the state of
the USB OTG port. Since the vusb3v1 regulator is required for the proper
operation of the mux and by extension the MADC and carkit mode, I
believe that the vusb3v1 regulator should never be disabled.
> Thank You!
> View this message in context: http://gumstix.8.x6.nabble.com/twl4030-madc-read-errors-tp4967139.html > Sent from the Gumstix mailing list archive at Nabble.com.
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter >
Since the post, I've had to change the code in static void twl4030_phy_power(struct twl4030_usb *twl, int on)
to set the TWL4030_USB_CARKIT_ANA_CTRL register, everytime (whether on-or off). I have yet to find a better fix for this problem.
However, what this does is I can get proper readings on ADCIN3-6 with USB OTG working properly, where previously I was not able to use ADCIN3-6 while a OTG cable was plugged in, or in my case if g_ether was being used.
Michael Lindemuth and Frank Agius's suggestions fixed my system as well.
With no mods to the OpenEmbedded omap3-console-image 3.2 kernel, ADC 3-6 would read noise if the USB OTG port was disconnected, and they would all read around 12mV regardless of what was being fed to them if the USB OTG port was connected.
After applying Michael Lindemuth's patch, ADC 3-6 would track the input voltage, but always read about 10% low if the USB OTG port was disconnected, and they would all read perfectly if the USB OTG port was connected.
Adding in Frank Agius's suggestion, ADC 3-6 now read perfectly all the time.