(Resource temporarily unavailable)Error while reading ADC pins

I am getting resource temporary unavailable when I tried to read ADC pins from BeagleBone Black

root@beaglebone:~# cat /sys/devices/ocp.2/helper.11/AIN*
cat: /sys/devices/ocp.2/helper.11/AIN0: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN1: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN2: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN3: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN4: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN5: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN6: Resource temporarily unavailable
cat: /sys/devices/ocp.2/helper.11/AIN7: Resource temporarily unavailable

What might be the reason for the error ?
The ADC pins AIN0 to AIN5 are connected to thermistors and the actual voltage at the ADC pins is around 0.77 volt

Does anyone have any help on this? I’m getting this too, using Ubuntu on the Beaglebone Black. I’ve upgrade to 3.8.13-bone31 (the only higher version is 3.12 but I can’t get the cape to load)

I get some valid readings (for maybe a few minutes after I load the cape) then I get the resource temporarily unavailable, and there’s nothing in the dmesg output to indicate an error :frowning:

when I try to unexport the cape I get:

Dec 3 19:38:04 brewery kernel: [ 873.063510] Unable to handle kernel NULL pointer dereference at virtual address 0000001b
Dec 3 19:38:04 brewery kernel: [ 873.072312] pgd = df308000
Dec 3 19:38:04 brewery kernel: [ 873.075179] [0000001b] *pgd=9f475831, *pte=00000000, *ppte=00000000
Dec 3 19:38:04 brewery kernel: [ 873.081805] Internal error: Oops: 17 [#1] SMP ARM
Dec 3 19:38:04 brewery kernel: [ 873.086721] Modules linked in: g_multi libcomposite r8712u© hid_ntrig
Dec 3 19:38:04 brewery kernel: [ 873.093665] CPU: 0 Tainted: G C (3.8.13-bone31 #1)
Dec 3 19:38:04 brewery kernel: [ 873.099955] PC is at omap_device_idle+0x10/0x54
Dec 3 19:38:04 brewery kernel: [ 873.104689] LR is at _od_runtime_suspend+0x1c/0x24
Dec 3 19:38:04 brewery kernel: [ 873.109697] pc : [] lr : [] psr: a0000013
Dec 3 19:38:04 brewery kernel: [ 873.109697] sp : de5bbd68 ip : df0484cc fp : de155c18
Dec 3 19:38:04 brewery kernel: [ 873.121695] r10: de5bbda0 r9 : c0059db0 r8 : 00000000
Dec 3 19:38:04 brewery kernel: [ 873.127155] r7 : 60000013 r6 : 00000000 r5 : df28f410 r4 : 00000000
Dec 3 19:38:04 brewery kernel: [ 873.133976] r3 : 00000000 r2 : 000c000b r1 : df28f480 r0 : df28f400
Dec 3 19:38:04 brewery kernel: [ 873.140800] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Dec 3 19:38:04 brewery kernel: [ 873.148256] Control: 10c5387d Table: 9f308019 DAC: 00000015
Dec 3 19:38:04 brewery kernel: [ 873.154260] Process bash (pid: 1491, stack limit = 0xde5ba240)
Dec 3 19:38:04 brewery kernel: [ 873.160356] Stack: (0xde5bbd68 to 0xde5bc000)
Dec 3 19:38:04 brewery kernel: [ 873.182260] bd60: 00000000 c0028540 00000000 df28f410 c0028524 c038e278
Dec 3 19:38:04 brewery kernel: [ 873.199820] bd80: c094f4d8 df28f410 00000000 c038e7d8 60000013 00000001 00000003 00000000
Dec 3 19:38:04 brewery kernel: [ 873.215648] bda0: de664e00 fffffdf4 de5ba000 df28f410 00000000 df28f480 60000013 00200200
Dec 3 19:38:04 brewery kernel: [ 873.227851] bdc0: c066a264 de623df8 de155c18 c038f684 00000000 df28f410 c0027984 00000004
Dec 3 19:38:04 brewery kernel: [ 873.236519] bde0: 60000013 c038ae38 df28f410 c038e278 c094f4d8 df28f410 00000000 c038ebb8
Dec 3 19:38:04 brewery kernel: [ 873.252565] be00: df28f51c df28f410 00000004 df28f480 60000013 c038ed10 c03943f4 df28f410
Dec 3 19:38:04 brewery kernel: [ 873.272087] be20: df7f9b10 c099be08 00000000 c039fbe8 c039fbbc df28f410 c099d194 c03878e0
Dec 3 19:38:04 brewery kernel: [ 873.287712] be40: c03878cc c03862d8 df578580 df28f444 df28f410 c038633c 00000000 df28f410
Dec 3 19:38:04 brewery kernel: [ 873.304292] be60: df04843c c0385e70 df28f410 df0b7200 df0b7210 c03840e8 df28f400 df0b7200
Dec 3 19:38:04 brewery kernel: [ 873.312980] be80: 00000000 c0387c58 df28f400 c0387e74 df47d680 c04d1bf8 0000002b df47d680
Dec 3 19:38:04 brewery kernel: [ 873.338590] bea0: de623dc0 de623df8 00100100 c04d1cc4 df578580 ffffffff ffffffb0 de623dc8
Dec 3 19:38:04 brewery kernel: [ 873.361964] bec0: de623dc0 de623e10 db25f000 c04d2498 de39e410 00000000 df0d7c10 de00da58
Dec 3 19:38:04 brewery kernel: [ 873.381545] bee0: df0d7c10 c039c69c 00000007 de155c20 00000003 c039dca8 ffffffff de00da58
Dec 3 19:38:04 brewery kernel: [ 873.394988] bf00: c09c05c0 c061992c 22222222 22222222 22222222 de157f48 de00da40 00000003
Dec 3 19:38:04 brewery kernel: [ 873.404766] bf20: de00da58 de5bbf80 c066a264 df0d7c18 00000000 c0382ed0 00000003 c014e684
Dec 3 19:38:04 brewery kernel: [ 873.424443] bf40: de333bc0 000ac408 00000003 de5bbf80 000ac408 de5ba000 00000003 c00f5474
Dec 3 19:38:04 brewery kernel: [ 873.440066] bf60: de333bc0 000ac408 00000000 00000000 de333bc0 00000000 000ac408 c00f5754
Dec 3 19:38:04 brewery kernel: [ 873.461551] bf80: 00000000 00000000 00000003 00000003 000ac408 b6f55a78 00000004 c000da04
Dec 3 19:38:04 brewery kernel: [ 873.477265] bfa0: 00000000 c000d880 00000003 000ac408 00000001 000ac408 00000003 00000000
Dec 3 19:38:04 brewery kernel: [ 873.487589] bfc0: 00000003 000ac408 b6f55a78 00000004 00000003 00000000 000a6094 00000000
Dec 3 19:38:05 brewery kernel: [ 873.497337] bfe0: 00000000 be9368ac b6ec444d b6efbfbc 40070010 00000001 00000000 00000019
Dec 3 19:38:05 brewery kernel: [ 873.506043] [] (omap_device_idle+0x10/0x54) from [] (_od_runtime_suspend+0x1c/0x24)
Dec 3 19:38:05 brewery kernel: [ 873.515928] [] (_od_runtime_suspend+0x1c/0x24) from [] (__rpm_callback+0x30/0x58)
Dec 3 19:38:05 brewery kernel: [ 873.525620] [] (__rpm_callback+0x30/0x58) from [] (rpm_suspend+0x2b0/0x4a4)
Dec 3 19:38:05 brewery kernel: [ 873.534760] [] (rpm_suspend+0x2b0/0x4a4) from [] (__pm_runtime_suspend+0x48/0x90)
Dec 3 19:38:05 brewery kernel: [ 873.544444] [] (__pm_runtime_suspend+0x48/0x90) from [] (pm_generic_runtime_idle+0x20/0x50)
Dec 3 19:38:05 brewery kernel: [ 873.555037] [] (pm_generic_runtime_idle+0x20/0x50) from [] (__rpm_callback+0x30/0x58)
Dec 3 19:38:05 brewery kernel: [ 873.565084] [] (__rpm_callback+0x30/0x58) from [] (rpm_idle+0x180/0x228)
Dec 3 19:38:05 brewery kernel: [ 873.573948] [] (rpm_idle+0x180/0x228) from [] (__pm_runtime_idle+0x48/0x90)
Dec 3 19:38:05 brewery kernel: [ 873.583100] [] (__pm_runtime_idle+0x48/0x90) from [] (ti_tscadc_remove+0x2c/0x48)
Dec 3 19:38:05 brewery kernel: [ 873.592795] [] (ti_tscadc_remove+0x2c/0x48) from [] (platform_drv_remove+0x14/0x18)
Dec 3 19:38:05 brewery kernel: [ 873.602663] [] (platform_drv_remove+0x14/0x18) from [] (__device_release_driver+0x7c/0xc4)
Dec 3 19:38:05 brewery kernel: [ 873.613168] [] (__device_release_driver+0x7c/0xc4) from [] (device_release_driver+0x1c/0x28)
Dec 3 19:38:05 brewery kernel: [ 873.623852] [] (device_release_driver+0x1c/0x28) from [] (bus_remove_device+0xc8/0xd8)
Dec 3 19:38:05 brewery kernel: [ 873.633988] [] (bus_remove_device+0xc8/0xd8) from [] (device_del+0x108/0x16c)
Dec 3 19:38:05 brewery kernel: [ 873.643308] [] (device_del+0x108/0x16c) from [] (platform_device_del+0x14/0x44)
Dec 3 19:38:05 brewery kernel: [ 873.652810] [] (platform_device_del+0x14/0x44) from [] (platform_device_unregister+0xc/0x18)
Dec 3 19:38:05 brewery kernel: [ 873.663510] [] (platform_device_unregister+0xc/0x18) from [] (of_overlay_device_entry_change.isra.0+0xe8/0x16c)
Dec 3 19:38:05 brewery kernel: [ 873.675928] [] (of_overlay_device_entry_change.isra.0+0xe8/0x16c) from [] (of_overlay_revert_one+0x48/0x1e8)
Dec 3 19:38:05 brewery kernel: [ 873.688069] [] (of_overlay_revert_one+0x48/0x1e8) from [] (of_overlay_revert+0x3c/0x60)
Dec 3 19:38:05 brewery kernel: [ 873.698298] [] (of_overlay_revert+0x3c/0x60) from [] (bone_capemgr_remove_slot_no_lock+0x40/0xc8)
Dec 3 19:38:05 brewery kernel: [ 873.709436] [] (bone_capemgr_remove_slot_no_lock+0x40/0xc8) from [] (slots_store+0x78/0x3b0)
Dec 3 19:38:05 brewery kernel: [ 873.720118] [] (slots_store+0x78/0x3b0) from [] (dev_attr_store+0x18/0x24)
Dec 3 19:38:05 brewery kernel: [ 873.729170] [] (dev_attr_store+0x18/0x24) from [] (sysfs_write_file+0x100/0x148)
Dec 3 19:38:05 brewery kernel: [ 873.738751] [] (sysfs_write_file+0x100/0x148) from [] (vfs_write+0xa8/0x178)
Dec 3 19:38:05 brewery kernel: [ 873.747963] [] (vfs_write+0xa8/0x178) from [] (sys_write+0x38/0x64)
Dec 3 19:38:05 brewery kernel: [ 873.756362] [] (sys_write+0x38/0x64) from [] (ret_fast_syscall+0x0/0x30)
Dec 3 19:38:05 brewery kernel: [ 873.770224] Code: e3500000 e92d4010 01a04000 159041c8 (e5d4301b)
Dec 3 19:38:05 brewery kernel: [ 873.776680] —[ end trace 11c5dfaa4d81386f ]—

The problem seems to arise when I am trying to access ADC continuously without delay.
When I tried to access ADC continuously, the “Resource temporarily unavailable” error remained constant and I was not able to read ADC unless I rebooted the system.

If I give a delay after reading each ADC value,
Occassionally I do get “Resource temporarily unavailable” error but it just remains for a few seconds and I am able to read ADC again normally.

Is there a reason why “overreading” causes the issue? I’ve noticed I can cause it by running a:

find /sys/devices -iname ain*

Which is really annoying!

Hi guys - have any of you reached a resolution on this? I’ve been getting it intermittently since the start with my BBB, 3.8.13, but just now as I start to use more of the AIN pins I’ve started seeing what is reported here, that it locks up and I have to reboot to recover access to the AIN pins. I quickly lose access again, making my BBB kind of not fit for this particular purpose, which is frustrating :). Any info gratefully received, any requested further info happily posted.

Cheers

The ADC kernel drivers throw errors when reading multiple channels, you
can either deal with it or fix the driver. So far, I've just dealt with
it, ignoring the resource unavailable error and just continuing on:

Python code example:
https://github.com/cdsteinkuehler/linuxcnc/blob/MachineKit-ubc/configs/ARM/BeagleBone/BeBoPr-Bridge/ReadTemp.py#L303

The resource unavailable error is thrown in a consistent pattern, but
the pattern changes depending on which channels you're actually reading.
Also, the errors are not time sensitive. I get the same patten of
errors when performing reads by hand (using cat at the command line,
with _seconds_ between reads) as I do reading via a program with a 50 mS
delay.

I'm hoping they finally fixed this in the newer kernels.

I have the same problem. But I read that you can patch the driver (http://hipstercircuits.com/reading-analog-adc-values-on-beaglebone-black/) but I dont know how to do it. Any body know how to use the adc-patches files?

Thanks!!!

Was this ever fixed in any build? This is causing me to not be able to use my BBB as my 3d printer controller. I’m actually using Charles’s fix above, but it is throwing the error so much that my heater cartridge will not heat up, or heats up to meltdown point.

Hi,

Was this ever fixed in any build? This is causing me to not be able to use my BBB as my 3d printer controller. I’m actually using Charles’s fix above, but it is throwing the error so much that my heater cartridge will not heat up, or heats up to meltdown point.

What kernel/do you use?

I have machinekit+Yocto running to control my 3D printer with the 3.8.x Xenomai kernel of Charles.[1][2] You can also use the official Debian image from Charles.[3] This is more an “out of the box” experience.
I also did experiments with 3.14.x. There I did not manage to read the raw value directly due to “Resource temporarily unavailable”, but I am able to read 2 Analog channels with the generic_buffer test. Most likely more channels would work as well, but I don’t need more at the moment.

Regards,

Robert

[1] GitHub - RobertBerger/meta-machinekit: meta-machinekit
[2] GitHub - RobertBerger/meta-machinekit-bsp: meta-machinekit-bsp
[3] Machinekit Blog: Machinekit Images

Elsewhere (i.e. in another thread) I have asked about the relationship
between the raw ADC values (the real 12-bit ones) and the processed 0
to 1799 mV values. However no one seems to be able to point me to how
they are connected, i.e. how the 0-1799 values are produced from the
0-4095 ones.

Is there any processing involved other than a straight multiplication
by 1799/4095? I.e. is there any smoothing by weighted average or
anything like that?

When I tried to read both the raw values and the processed ones as
close together as possible in time it seemed to me that, at the very
least, there was some sort of time delay between them.