Re: [beagleboard] ADC generic_buffer.c issues || Accessing ADC from own kernel module

2015-09-17 Thread Mickae1
Nuno I Tried the file generic_buffer ( found it on the kernel 4.0 : 
http://lxr.free-electrons.com/source/drivers/staging/iio/Documentation/generic_buffer.c?v=4.0
 
) 

But I got :

root@beaglebone:/# ./generic_buffer -n TI-am335x-adc -t sysfstrig1 -l 128
iio device number being used is 0
*Failed to find the trigger sysfstrig1*

Maybe I'm not using it correctly


cat /dev/iio\:device0

give a lot of data ^^



Le jeudi 13 août 2015 03:46:58 UTC+2, Nuno a écrit :
>
> On 08/12/2015 06:51 PM, Maro wrote: 
> > So the goal is almost identical to the generic_buffer.c application 
> > referenced on this wiki [ 
> > http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver's_Guide] 
> > 
>
> It shouldn't matter, but if you are willing to upgrade the kernel (ubuntu 
> 14.04, Linux kernel 4.1.4-ti-r9), 
> you could follow the updated version instead: 
>
> http://processors.wiki.ti.com/index.php/Linux_Core_ADC_User's_Guide 
>
> I just used Robert Nelson kernel (linux-image-4.1.4-ti-r9) and 
> updated/added the required entry 
> to the device tree: 
>
> tscadc@44e0d000 { 
> compatible = "ti,am3359-tscadc"; 
> reg = <0x44e0d000 0x1000>; 
> interrupt-parent = <0x1>; 
> interrupts = <0x10>; 
> ti,hwmods = "adc_tsc"; 
> status = "okay"; 
> linux,phandle = <0xc5>; 
> phandle = <0xc5>; 
>
> tsc { 
> compatible = "ti,am3359-tsc"; 
> }; 
>
> adc { 
> #io-channel-cells = <0x1>; 
> compatible = "ti,am3359-adc"; 
> linux,phandle = <0xc6>; 
> phandle = <0xc6>; 
> ti,adc-channels = <0 1 2 3 4 5 6 7>; 
> }; 
> }; 
>
>
>
> I didn't try with the .c application with this version yet, but I can read 
> the raw values directly: 
>
> (AN4 connected to the board analog ground) 
>
> ~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
> 12 
>
> (AN4 connected to the board 1.8V ) 
>
> ~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
> 4083 
>
>
> cheers, 
> Nuno 
>
> -- 
>

-- 
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.


Re: [beagleboard] ADC generic_buffer.c issues || Accessing ADC from own kernel module

2015-08-13 Thread Maro
For the linux-image-4.1.4-ti-r9 RN kernel image- Did you just compile from 
source from https://github.com/beagleboard/linux/tree/4.1

-
I can read the values manually too but thats where it starts to fall apart: 
root@beaglebone:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw 

3885

root@beaglebone:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw 

3885




Do you see the buffer dir on the 4.14 kernel- as shown in the ti wiki?

root@arago-armv7:~# ls -al /sys/bus/iio/devices/iio\:device0/buffer/
drwxr-xr-x2 root root0 Jan  1 00:00 .
drwxr-xr-x5 root root0 Jan  1 00:00 ..
-rw-r--r--1 root root 4096 Jan  1 00:01 bytes_per_datum
-rw-r--r--1 root root 4096 Jan  1 00:01 enable
-rw-r--r--1 root root 4096 Jan  1 00:01 length




---


Do you have any problems dropping the adc into  continuous mode? 

root@arago-armv7:~# echo 1 > 
/sys/bus/iio/devices/iio\:device0/scan_elements/in_voltage0_en
root@arago-armv7:~# echo 1 > 
/sys/bus/iio/devices/iio\:device0/scan_elements/in_voltage5_en
root@arago-armv7:~# echo 1 > 
/sys/bus/iio/devices/iio\:device0/scan_elements/in_voltage7_en

root@arago-armv7:~# echo 100 > /sys/bus/iio/devices/iio\:device0/buffer/length

root@arago-armv7:~# echo 1 > /sys/bus/iio/devices/iio\:device0/buffer/enable

root@arago-armv7:~# echo 0 > /sys/bus/iio/devices/iio\:device0/buffer/enable


 

On Wednesday, August 12, 2015 at 7:46:58 PM UTC-6, Nuno wrote:
>
> On 08/12/2015 06:51 PM, Maro wrote: 
> > So the goal is almost identical to the generic_buffer.c application 
> > referenced on this wiki [ 
> > http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver's_Guide] 
> > 
>
> It shouldn't matter, but if you are willing to upgrade the kernel (ubuntu 
> 14.04, Linux kernel 4.1.4-ti-r9), 
> you could follow the updated version instead: 
>
> http://processors.wiki.ti.com/index.php/Linux_Core_ADC_User's_Guide 
>
> I just used Robert Nelson kernel (linux-image-4.1.4-ti-r9) and 
> updated/added the required entry 
> to the device tree: 
>
> tscadc@44e0d000 { 
> compatible = "ti,am3359-tscadc"; 
> reg = <0x44e0d000 0x1000>; 
> interrupt-parent = <0x1>; 
> interrupts = <0x10>; 
> ti,hwmods = "adc_tsc"; 
> status = "okay"; 
> linux,phandle = <0xc5>; 
> phandle = <0xc5>; 
>
> tsc { 
> compatible = "ti,am3359-tsc"; 
> }; 
>
> adc { 
> #io-channel-cells = <0x1>; 
> compatible = "ti,am3359-adc"; 
> linux,phandle = <0xc6>; 
> phandle = <0xc6>; 
> ti,adc-channels = <0 1 2 3 4 5 6 7>; 
> }; 
> }; 
>
>
>
> I didn't try with the .c application with this version yet, but I can read 
> the raw values directly: 
>
> (AN4 connected to the board analog ground) 
>
> ~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
> 12 
>
> (AN4 connected to the board 1.8V ) 
>
> ~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
> 4083 
>
>
> cheers, 
> Nuno 
>
> -- 
>

-- 
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.


Re: [beagleboard] ADC generic_buffer.c issues || Accessing ADC from own kernel module

2015-08-12 Thread Nuno Sucena Almeida
On 08/12/2015 06:51 PM, Maro wrote:
> So the goal is almost identical to the generic_buffer.c application
> referenced on this wiki [
> http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver's_Guide] 
> 

It shouldn't matter, but if you are willing to upgrade the kernel (ubuntu 
14.04, Linux kernel 4.1.4-ti-r9), 
you could follow the updated version instead:

http://processors.wiki.ti.com/index.php/Linux_Core_ADC_User's_Guide

I just used Robert Nelson kernel (linux-image-4.1.4-ti-r9) and updated/added 
the required entry 
to the device tree:

tscadc@44e0d000 {
compatible = "ti,am3359-tscadc";
reg = <0x44e0d000 0x1000>;
interrupt-parent = <0x1>;
interrupts = <0x10>;
ti,hwmods = "adc_tsc";
status = "okay";
linux,phandle = <0xc5>;
phandle = <0xc5>;

tsc {
compatible = "ti,am3359-tsc";
};

adc {
#io-channel-cells = <0x1>;
compatible = "ti,am3359-adc";
linux,phandle = <0xc6>;
phandle = <0xc6>;
ti,adc-channels = <0 1 2 3 4 5 6 7>;
};
};



I didn't try with the .c application with this version yet, but I can read the 
raw values directly:

(AN4 connected to the board analog ground)

~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
12

(AN4 connected to the board 1.8V )

~$ cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw 
4083


cheers,
Nuno

-- 

-- 
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.


[beagleboard] ADC generic_buffer.c issues || Accessing ADC from own kernel module

2015-08-12 Thread Maro
Hoping you guys can help me out on this:

Goal: High sample rate of one ADC line via a kernel module and a 
corresponding user space app

Now I know the PRU would be great for this- and I plan on also writing a 
pru version to bench mark the diff but I'm currently trying to get it done 
with a kernel module and its turned into one of those annoying obsessions 
that should work and damn it-- I am going to make it work 

So the goal is almost identical to the generic_buffer.c application 
referenced on this wiki [ 
http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver's_Guide] 

but I've been fight it for awhile with no results. 

Current version: Linux beaglebone 3.8.13-bone70 
1: pulled there git repo 
2: applied the patch to get rid of the trigger stuff found here 
3: compiled:
gcc --static generic_buffer.c -o generic_buffer
4: Issues happen now because sysfs seem to be so different, I'm not sure 
contionous mode can be turned on? 

./generic_buffer -n tiadc -l 256 -c 1
iio device number being used is 0
Problem reading scan element information
diag /sys/bus/iio/devices/iio:device0
 

5: This error leads down the rabbit hole to this semi unhelpful blog post: 
https://e2e.ti.com/support/arm/sitara_arm/f/791/t/365886 yielding an errata 
about `Continuous capture mode is not supported in the 3.12 kernel`; great 
we are still rocking a 3.8.13 kernel thus should be fine? 

--
Couple questions: 
1: Is there bbb kernel version that plays nice with the iio driver that 
will allow this generic_buffer.c to work? if so details please
2: if not has anyone modified this demo app to make things work? I've seen 
a couple posts about it here  
2: Is there any information to say screw it and read the adc values 
directly in my own ko? I've seen instructions on gpio but not the adc 
lines. 

-- 
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.