Curt Carpenter <1cjcarpenter-fodfmywu...@public.gmane.org> writes:

> Am I correct in understanding that there is no documentation that
> would have pointed me to the /sys/bus/iio/devices/iio:device0
> directory and given me some guidance on what it contained?

Ok. You enticed me to provide a more detailed answer :) I started
thinking about the question, "How do I use the ADC on this board and the
answer can't be just: use python?" I'll try to point out some
assumptions and links to docs. I'm not an expert on this, so perhaps
there is a better way.

1.) You have to know that the linux kernel is the mechanism to provide
software interfaces to the hardware.

2.) The kernel does have documentation for most major
subsystems. Granted, some "documentation" is in the form of comments,
but it is there. If you downloaded the kernel or use the free electrons
site to search for "adc" you'd find this:
http://lxr.free-electrons.com/source/drivers/staging/iio/Documentation/overview.txt.
 This
is the root documentation on using the kernel's Industrial I/O subsystem
or IIO. If you root around in that directory, you'll find "the
definitive" guide to using this interface.

2.a.) The kernel documentation often assumes you are familiar with the
kernel :) It's a bit circular I guess. There is a great book, Linux
Device Drivers, which is available for free:
http://lwn.net/Kernel/LDD3/. The kernel version is quite old now (2.6)
but the *basics* are helpful for understanding what's going on. Just
remember that it was a snapshot in time.

OK. So that's the IIO interface. But how do you know the BeagleBone has
the hardware to use it?

There a few pieces of knowledge you have to connect here. The first is
that one would expect a driver for TI's ADC for the AM335x to be in the
kernel. Some more searching through the sources reveals this:
https://github.com/beagleboard/linux/blob/master/drivers/iio/adc/ti_am335x_adc.c

That looks like a likely candidate. Then, we need a method to map this
driver to the hardware. The more generic question is, how does the
kernel know what hardware lies beneath it? From what I understand, this
is done with the *device tree.* So, you need to find the device tree
file that defines the use of this driver. This looks like it here:

https://github.com/beagleboard/linux/blob/e29980c36939818c225a233284535cff73d9ed53/arch/arm/boot/dts/am33xx.dtsi#L808

But, that's a generic device tree for the AM3XX series, what about the
more specific BeagleBone black? More searching:
https://github.com/beagleboard/linux/search?p=2&q=am33xx.dtsi

>From there you should see the mapping to the registers in the TRM.

I'm not familiar with the particular driver *at all*, so this may not be
the correct pairing. :) However, this is the process that generally
works for me and I don't think it's too off base. If it is, hopefully
somebody will correct me here.

Josh

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to