izmit escort escort ankara adana escort

 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: How to configure sama5d4_xplained_pro for 5-wire touchscreen
PostPosted: Thu Jan 26, 2017 4:09 pm 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
hello Experts,

I'm trying to get a 5-wire touchscreen to work with the ADC on the Sama5d4_xplained_ultra.
It is connected to PIN A1 to A5 on J7. I'm running Linux4sam_5.5 with the following sama5d4.dtsi file:

Code:
         adc0: adc@fc034000 {
            compatible = "atmel,at91sam9x5-adc";
            reg = <0xfc034000 0x100>;
            interrupts = <44 IRQ_TYPE_LEVEL_HIGH 5>;
            clocks = <&adc_clk>,
                <&adc_op_clk>;
            clock-names = "adc_clk", "adc_op_clk";
            atmel,adc-channels-used = <0x01f>;
            /*atmel,adc-channels-used = <0x0>;*/
            atmel,adc-startup-time = <40>;
            atmel,adc-use-external-triggers;
            atmel,adc-vref = <3300>;
            atmel,adc-res = <8 10>;
            atmel,adc-sample-hold-time = <11>;
            atmel,adc-res-names = "lowres", "highres";
            /*atmel,adc-ts-pressure-threshold = <10000>;*/
            atmel,adc-ts-pressure-threshold = <10000>;
            atmel,adc-ts-wires = <5>;
            atmel,adc-clock-rate = <1000000>;
            status = "okay";
            trigger@0 {
               trigger-name = "external-rising";
               trigger-value = <0x1>;
               trigger-external;
            };
            trigger@1 {
               trigger-name = "external-falling";
               trigger-value = <0x2>;
               trigger-external;
            };
            trigger@2 {
               trigger-name = "external-any";
               trigger-value = <0x3>;
               trigger-external;
            };
            trigger@3 {
               trigger-name = "continuous";
               trigger-value = <0x6>;
            };
         };


I'm using X as a graphical interface and according to its log, it sees the touchscreen just fine. See below:
Code:
[2526457.986] (II) config/udev: Adding input device at91_adc (/dev/input/event1)
[2526457.987] (**) at91_adc: Applying InputClass "evdev touchscreen catchall"
[2526457.987] (**) at91_adc: Applying InputClass "calibration"
[2526457.987] (II) Using input driver 'evdev' for 'at91_adc'
[2526457.987] (**) at91_adc: always reports core events
[2526457.987] (**) evdev: at91_adc: Device: "/dev/input/event1"
[2526457.988] (--) evdev: at91_adc: Vendor 0 Product 0
[2526457.988] (--) evdev: at91_adc: Found absolute axes
[2526457.988] (--) evdev: at91_adc: Found x and y absolute axes
[2526457.988] (--) evdev: at91_adc: Found absolute touchscreen
[2526457.988] (**) Option "SwapAxes" "1"
[2526457.988] (II) evdev: at91_adc: Configuring as touchscreen
[2526457.989] (**) evdev: at91_adc: YAxisMapping: buttons 4 and 5
[2526457.989] (**) evdev: at91_adc: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[2526457.989] (**) Option "config_info" "udev:/sys/devices/soc0/ahb/ahb:apb/fc034000.adc/input/input1/event1"
[2526457.989] (II) XINPUT: Adding extended input device "at91_adc" (type: TOUCHSCREEN, id 7)
[2526457.989] (II) evdev: at91_adc: initialized for absolute axes.
[2526457.991] (**) at91_adc: (accel) keeping acceleration scheme 1
[2526457.992] (**) at91_adc: (accel) acceleration profile 0
[2526457.992] (**) at91_adc: (accel) acceleration factor: 2.000
[2526457.992] (**) at91_adc: (accel) acceleration threshold: 4
[2526457.995] (II) config/udev: Adding input device at91_adc (/dev/input/mouse0)
[2526457.995] (**) at91_adc: Applying InputClass "calibration"
[2526457.995] (II) No input driver specified, ignoring this device.
[2526457.995] (II) This device may have been added with another device file.
[2526457.998] (II) config/udev: Adding input device gpio_keys (/dev/input/event2)
[2526457.998] (II) No input driver specified, ignoring this device.
[2526457.998] (II) This device may have been added with another device file.
#


That being said, nothing happens when I tap the screen with my stylus. Similarly, EVTEST detects no events from the touchscreen.

Code:
# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Dell Dell USB Entry Keyboard
/dev/input/event1:      at91_adc
/dev/input/event2:      gpio_keys
Select the device event number [0-2]: 1
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "at91_adc"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max     4095
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max     4095
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max   16777215
Properties:
Testing ... (interrupt to exit)


On the bright side, using 'devmem 0xFC0340B4 32' and 'devmem 0xFC0340B8 32', I can tell that the values in the ADC registers seem to update correctly based on where I tap on the screen.

Finally, note that the board LED stops blinking and serial console is stuck when I press the pen onto the screen. Kinda looks like the CPU keeps processing interupts...

I'm pretty much stuck and need ideas on what to look at.

Am I supposed to do anything with the GPIO ?

Any help would be greatly appreciated.

Thanks,
Alex


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Fri Feb 10, 2017 10:16 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1389
Location: USA
CortexAlex wrote:
It is connected to PIN A1 to A5 on J7.
Are you sure you've made the proper connections?
On several 4-pin touchscreens that I've looked at, none of them arrange the signals on the flex cable in the order required by the board connector.

CortexAlex wrote:
I'm running Linux4sam_5.5 with the following sama5d4.dtsi file:
The .dtsi file for the SoC should not be modified.
It should be kept generic for inclusion by any/every board.

Make your changes to the board-level file(s), e.g. the .dts file.

CortexAlex wrote:
Code:
            atmel,adc-clock-rate = <1000000>;
Where did this property come from?
It probably does no harm (or anything at all), but did you make this up?

Try a larger adc-ts-pressure-threshold.
For a 4-pin touchscreen, the threshold had to be increased to 40000.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Wed Mar 08, 2017 1:02 pm 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
blue_z wrote:
CortexAlex wrote:
It is connected to PIN A1 to A5 on J7.
Are you sure you've made the proper connections?
Scoping the signals looked correct so that's how I confirmed it.
blue_z wrote:
The .dtsi file for the SoC should not be modified.
It should be kept generic for inclusion by any/every board.

Make your changes to the board-level file(s), e.g. the .dts file.
That's corrected now.
blue_z wrote:
CortexAlex wrote:
Code:
            atmel,adc-clock-rate = <1000000>;
Where did this property come from?
Removed it (Got misled by some messages I read in the boot sequence).
blue_z wrote:
Try a larger adc-ts-pressure-threshold.
For a 4-pin touchscreen, the threshold had to be increased to 40000.
OK I made it my new default.


Just to get this out of the way, could you confirm I'm indeed supposed to use the at91_adc.ko driver and not the at91-sama5d2_adc.ko driver ?


I would also need clarification on the following behavior. If I remove the following line from the .dts:
Code:
atmel,adc-ts-wires = <5>;
then I can access the those files:
Code:
/sys/bus/iio/devices/iio\:device0/scan_elements/in_voltageX_en
and do some low level tests with the triggers and buffer. When I put the line back in the .dts, then the files are then missing.
Probably expected behavior but I could use the explanations or pointers.

Regards.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Thu Mar 09, 2017 2:55 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1389
Location: USA
CortexAlex wrote:
Just to get this out of the way, could you confirm I'm indeed supposed to use the at91_adc.ko driver and not the at91-sama5d2_adc.ko driver ?
Refer to the .dtsi file for the SoC.
The "compatible" property string for the device will identify/specify the appropriate driver (i.e. the driver code will have the identical string in its of_device_id structure.
BTW a device driver is typically referred to by either its name or its source code filename, rather than the name of the (optionally-built) loadable module.
CortexAlex wrote:
If I remove the following line from the .dts:
Code:
atmel,adc-ts-wires = <5>;
then I can access the those files:
Code:
/sys/bus/iio/devices/iio\:device0/scan_elements/in_voltageX_en
and do some low level tests with the triggers and buffer. When I put the line back in the .dts, then the files are then missing.
That is the expected behavior.
The atmel,adc-ts-wires= property is described in Linux kernel Documentation/devicetree/bindings/iio/adc/at91_adc.txt.
The Atmel SoC datasheet has the details on the touchscreen mode of the ADC.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Wed Mar 15, 2017 10:48 am 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
CortexAlex wrote:
The atmel,adc-ts-wires= property is described in Linux kernel Documentation/devicetree/bindings/iio/adc/at91_adc.txt.
Thanks, that's what I was looking for.
CortexAlex wrote:
The Atmel SoC datasheet has the details on the touchscreen mode of the ADC.
Yup, already using this for references.

I'm using debugfs for debugging, configured as follow:
Code:
mount -t debugfs none /sys/kernel/debug/
echo -n 'file at91_adc.c -p' > /sys/kernel/debug/dynamic_debug/control
echo -n 'file kfifo_buf.c -p' > /sys/kernel/debug/dynamic_debug/control
echo -n 'file industrialio-buffer-cb.c -p' > /sys/kernel/debug/dynamic_debug/control
echo -n 'file industrialio-triggered-buffer.c -p' > /sys/kernel/debug/dynamic_debug/control
tail -f /sys/kernel/debug/dynamic_debug/control | grep iio &

I noticed the following errors in the dynamic_debug/control buffer:
Code:
drivers/iio/industrialio-buffer.c:606 [industrialio]iio_buffer_request_update =_ "Buffer not started: buffer parameter update failed (%d)\012"
drivers/iio/industrialio-buffer.c:740 [industrialio]iio_enable_buffers =_ "Buffer not started: buffer preenable failed (%d)\012"
drivers/iio/industrialio-buffer.c:752 [industrialio]iio_enable_buffers =_ "Buffer not started: update scan mode failed (%d)\012"
drivers/iio/industrialio-buffer.c:763 [industrialio]iio_enable_buffers =_ "Buffer not started: postenable failed (%d)\012"
I know Industrial IO are an important part of the whole ADC driver chain so should I be investigating those errors first or are they not related to touchscreen support ?

Regards.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Thu Mar 16, 2017 12:33 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1389
Location: USA
CortexAlex wrote:
I'm using debugfs for debugging, configured as follow:
That is the method to use, other than inserting printk()s.
You might want to scale back on which modules you enable in order to control the volume of messages.
CortexAlex wrote:
I know Industrial IO are an important part of the whole ADC driver chain so should I be investigating those errors first or are they not related to touchscreen support ?
Since you are not getting any touchscreen events, I'd be inclined to first look at the "data source" (i.e. is the z input detected, triggering conversions, and generating data), rather than at the middle of the data path (i.e. the IIO layer).
FWIW I have gotten this TS interface to function for a cheap 4-wire panel (although the raw coordinates are too nonlinear across the entire panel for the tslib to produce usable results).

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Thu Mar 16, 2017 5:57 pm 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
CortexAlex wrote:
FWIW I have gotten this TS interface to function for a cheap 4-wire panel (although the raw coordinates are too nonlinear across the entire panel for the tslib to produce usable results).
Do you happen to remember the size of that screen you tested ? From the looks of the signals on the scope (especially the time taken by Sense to stabilize), I'm beginning to wonder if that ADC driver can drive a 15'' touchscreen as-is.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Fri Mar 17, 2017 12:34 pm 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
I'm finally getting events.
blue_z wrote:
Since you are not getting any touchscreen events, I'd be inclined to first look at the "data source" (i.e. is the z input detected, triggering conversions, and generating data)
So you were correct there as z input is the source of the problem. As far as I can tell, the driver does not make the distinction between "4-wire with pressure measurement" and plain "5-wire" mode. I had to modify the following 2 functions to not care for the pressure measurement and associated interrupts: at91_adc_9x5_interrupt and at91_ts_sample.
Am I missing something else or is that a driver limitation ?

Regards.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Fri Mar 17, 2017 10:43 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1389
Location: USA
CortexAlex wrote:
As far as I can tell, the driver does not make the distinction between "4-wire with pressure measurement" and plain "5-wire" mode.
The device driver should not have to deal with that distinction beyond the initial configuration.
The different interfaces are handled in the hardware, and the outcome that the software sees is the same.
CortexAlex wrote:
I had to modify the following 2 functions to not care for the pressure measurement and associated interrupts: at91_adc_9x5_interrupt and at91_ts_sample.
Am I missing something else or is that a driver limitation ?
That sounds like an ugly kludge, but maybe you're on to something.
The datasheet does warn that the ADC_PRESSR values are only valid when in 4-wire with pressure-measurement mode.
Hard to believe that you're the first person to test this driver with a 5-wire TS panel.

If you're concerned about "driving" the TS panel, how are you powering your board?

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Tue Mar 21, 2017 11:08 am 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
CortexAlex wrote:
The datasheet does warn that the ADC_PRESSR values are only valid when in 4-wire with pressure-measurement mode.
Exactly, that's what made me hack the driver that way.
Now, is that specific to the SAMA5D4x, meaning that on other CPUs, the pressure interrupt is always raised even in the case of a 5-wire TS, I don't know (and it would not make sense anyway, right?)
CortexAlex wrote:
Hard to believe that you're the first person to test this driver with a 5-wire TS panel.
I'm with you on that one :wink: but fact is that it's not working as it on that particular CPU.
Gents at FreeElectrons would probably be a good source of info here. Do you know the official route to contact them about this ?
CortexAlex wrote:
If you're concerned about "driving" the TS panel
Not an issue anymore, I adjusted TOUCH_SCTIM_US appropriately and get good signals now.
CortexAlex wrote:
how are you powering your board?
Using a 2.4V / 5A power supply that drives that board and the TS.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Tue Mar 21, 2017 11:25 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1389
Location: USA
CortexAlex wrote:
Exactly, that's what made me hack the driver that way.
Are you now claiming that you were previously aware of that ADC_PRESSR register limitation, yet failed to mention it?
Why would you neglect to provide salient information that bolsters your case?

CortexAlex wrote:
Now, is that specific to the SAMA5D4x, meaning that on other CPUs, ...
The ADC with 5-wire touchscreen capability is also in the SAM9G15, SAM9G35, SAM9X35, and the SAMA5D3x.
All of these SoCs (not "CPUs") have the same restriction on the ADC_PRESSR register.
(The SAM9G45 has an ADC with only 4-wire touchscreen support).
CortexAlex wrote:
... the pressure interrupt is always raised even in the case of a 5-wire TS, I don't know (and it would not make sense anyway, right?)
I don't understand what you mean by "pressure interrupt is always raised".
Do you mean the interrupt is enabled or the interrupt status is active?

CortexAlex wrote:
Do you know the official route to contact them about this ?
The proper channel for communication is probably through the Linux ARM kernel mailing-list, but also CC the driver maintainer (?) and salient individuals, e.g. the author of the patch.
Read the guidelines before subscribing and posting, e.g. use plain text, no HTML.

CortexAlex wrote:
Using a 2.4V / 5A power supply that drives that board and the TS.
Presumably you have the volts and ampere numbers & units swapped.
Your attention to details needs improvement.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: How to configure sama5d4_xplained_pro for 5-wire touchsc
PostPosted: Wed Mar 22, 2017 10:40 am 
Offline

Joined: Thu Jan 26, 2017 12:48 pm
Posts: 7
blue_z wrote:
Are you now claiming that you were previously aware of that ADC_PRESSR register limitation, yet failed to mention it?
Why would you neglect to provide salient information that bolsters your case?
I'm so not following you here. I read the doc, found out about the pressure registers not being active on that chip, fixed the driver, end of the story.
CortexAlex wrote:
The ADC with 5-wire touchscreen capability is also in the SAM9G15, SAM9G35, SAM9X35, and the SAMA5D3x.
All of these have the same restriction on the ADC_PRESSR register.
(The SAM9G45 has an ADC with only 4-wire touchscreen support).
So either
    noone ever tested a 5-wire TS on all of those chips
    or those who did fixed the driver locally
    or those who did did not encounter the issue because the pressure interrupt is always raised. I don't know, just trying to find a logical explanation for this bug to have lasted so long
blue_z wrote:
The proper channel for communication is probably through the Linux ARM kernel mailing-list, but also CC the driver maintainer (?) and salient individuals, e.g. the author of the patch.
Read the guidelines before subscribing and posting, e.g. use plain text, no HTML.
Valuable information. Thanks.
CortexAlex wrote:
Using a 2.4V / 5A power supply that drives that board and the TS.
Make this 24V / 5A if that of any interest at all in our case.
blue_z wrote:
Your attention to details needs improvement.
That's not the only thing that needs improvement. Clearly.
Regards


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron