adafruit / adafruit/adafruit-beaglebone-io-python
ADC not found on BeagleBone Enhanced
- Dominant language
- C
- Stars
- 479
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
_**copied from comment on closed issued https://github.com/adafruit/adafruit-beaglebone-io-python/issues/269#issuecomment-610604001**_
@krupal756 wrote:
>
> This is my first time on github
>
> I am using Beaglebone Enhanced and I too ran into the same issue as @sampathkmurthy with the ADC Error, but I was able to find the problem and also solve it too.
>
> Finding the problem:
> I tried to google for the solution and found out this website (link below):
https://www.teachmemicro.com/beaglebone-black-adc/
> wherein he has explained for the exact location to probe for ADC raw values on Beaglebone Black on the command line, which is:
>
> /sys/bus/iio/devices/iio:device0
>
> When I tried to find the same on Enhanced and probed into /devices folder for iio:devices0, there were three folders iio:devices0,1 and 2. The in_voltage#_raw (# is the number) was missing, so I checked the same at other locations and found it in iio:device2.
I cross checked the Adafruit_BBIO library, to find out from which location the library was probing the raw values from, on github and found out the c file (link) on line no 58 which had the probing location:
>
> adafruit-beaglebone-io-python/source/c_adc.c
>
> `strncat(adc_prefix_dir, "/sys/bus/iio/devices/iio:device0/in_voltage", sizeof(adc_prefix_dir));`
>
> which will surely work for BBB, but may or may not work for other upgraded boards like Beaglebone Blue or Beaglebone Enhanced.
>
> Solution:
> What I did is I manually downloaded the complete Adafruit_BBIO library onto the board, and changed the location of the adc folder on the line as below (this is for Enhanced, you may need to find out yours)
>
> `strncat(adc_prefix_dir, "/sys/bus/iio/devices/iio:device2/in_voltage", sizeof(adc_prefix_dir));`
>
> and then reinstalled the library. After which I restarted the system and ran the adc example from Adafruit and it worked just perfectly fine.
>
> What I would like to suggest to @pdp7 to keep the flexibility of providing the adc folder location through the code, instead of fixed locations, as an update to the library, as most of the new boards as an additional input, if in case the manufacturer have these locations changed, we can fix it in our codes itself.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.