PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 8:48 am

That's recent enough - it's the last firmware released before the switch to the 4.14 kernel tree.

Start by renaming the compiled overlay to "ads7846-spi1.dtbo" to distinguish it from the original, comment out the current overlay directive in config.txt and replace it with:

Code: Select all

dtoverlay=ads7846-spi1
Verify that the driver module gets loaded. Then add the parameters, leaving out keep_vref_on, and splitting the line when it reaches 80 characters.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 8:52 am

its the firmware delivered with the screen, also with the same parameters.
Perhaps the supplier of the screen has modified the standard overlay - can you upload the original .dtbo (or .dtb) somewhere so I can take a look?

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 8:59 am

PhilE wrote:
Fri May 11, 2018 8:48 am
Start by renaming the compiled overlay to "ads7486-spi1.dtbo" to distinguish it from the original, comment out the current overlay directive in config.txt and replace it with:

Code: Select all

dtoverlay=ads7846-spi1
shouldn't be it :

Code: Select all

 dtoverlay=ads7486-spi1
?

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:04 am

PhilE wrote:
Fri May 11, 2018 8:52 am
its the firmware delivered with the screen, also with the same parameters.
Perhaps the supplier of the screen has modified the standard overlay - can you upload the original .dtbo (or .dtb) somewhere so I can take a look?
sure https://www.dropbox.com/sh/pdkji46ui8ae ... E2hva?dl=0

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 9:11 am

Code: Select all

dtoverlay=ads7846-spi1
shouldn't be it :

Code: Select all

dtoverlay=ads7486-spi1
No, this was correct - it was the rename I got wrong (now corrected).

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:11 am

ignore this post
Last edited by Robin466 on Fri May 11, 2018 9:22 am, edited 1 time in total.

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:21 am

PhilE wrote:
Fri May 11, 2018 9:11 am

Code: Select all

dtoverlay=ads7846-spi1
shouldn't be it :

Code: Select all

dtoverlay=ads7486-spi1
No, this was correct - it was the rename I got wrong (now corrected).
ah that did the trick, overlay is now loaded !

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 9:26 am

The default ads7846 overlay was unmodified, so it had no "keep_vref_on" parameter. This should not have prevented it from being loaded, but it was an error.

Using this configuration:

Code: Select all

dtdebug=1
dtoverlay=spi1-1cs,cs0_pin=16,cs0_spidev=off
dtoverlay=ads7846-spi1,penirq=5,penirq_pull=2,speed=50000,swapxy=0
dtparam=pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
post the "sudo vcdbg log msg" output (which will now be more verbose) and the output from "ls -l /boot/overlays/ads7846*".

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:29 am

PhilE wrote:
Fri May 11, 2018 9:26 am
The default ads7846 overlay was unmodified, so it had no "keep_vref_on" parameter. This should not have prevented it from being loaded, but it was an error.

Using this configuration:

Code: Select all

dtdebug=1
dtoverlay=spi1-1cs,cs0_pin=16,cs0_spidev=off
dtoverlay=ads7846-spi1,penirq=5,penirq_pull=2,speed=50000,swapxy=0
dtparam=pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
post the "sudo vcdbg log msg" output (which will now be more verbose) and the output from "ls -l /boot/overlays/ads7846*".
i allready did that without dtdebug=1, but Touch seems to be working right now.

However, its upside down, can raspberry change its orientation ?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 9:33 am

i allready did that without dtdebug=1, but Touch seems to be working right now.
Cool - our messages crossed.
However, its upside down, can raspberry change its orientation ?
Please describe carefully what is upside down relative to what.

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:38 am

PhilE wrote:
Fri May 11, 2018 9:33 am
i allready did that without dtdebug=1, but Touch seems to be working right now.
Cool - our messages crossed.
thank you for your patience and help during this fase ! :D
However, its upside down, can raspberry change its orientation ?
Please describe carefully what is upside down relative to what.
well if i press top left corner of the touch the cursor moves to de right lower corner so touch is upside down relative to the LCD (have rotated the image Display_rotate=0 (standard is display_rotate=2)

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 9:41 am

With "display_rotate=2" does the touchscreen match the image (but with a rotated image)?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 9:44 am

Does "lcd_rotate=2" (instead of "display_rotate=0") work (see viewtopic.php?p=815847#p815847)?

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:48 am

Yes, Correct only seems to be a little of in the middle, but calibration will do the trick i gues :-)

how ever when i put the rotate back to 0 the touch is upside down again

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 9:52 am

PhilE wrote:
Fri May 11, 2018 9:44 am
Does "lcd_rotate=2" (instead of "display_rotate=0") work (see viewtopic.php?p=815847#p815847)?
same story as down below.... :o :(

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 11:24 am

i tried this procedure, however doesn't seem to be working right now...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 11:29 am

I've asked @jamesh if he has any suggestions.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22754
Joined: Sat Jul 30, 2011 7:41 pm

Re: ads7846 on spi1

Fri May 11, 2018 11:45 am

So this is a SPI based touchscreen, on an LCD panel, but not one of ours?

Quite a few TS drivers I've seen have DT parameters to do swaps/mirrors. Quick look at the kernel driver shows there is a boolean DT parameter

`swap-xy`

Does that work? (See drivers/input/touchscreen/ads7846.c for all the DT parameters)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2228
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ads7846 on spi1

Fri May 11, 2018 11:57 am

The swap-xy parameter swaps the axes - x becomes y and vice versa, whereas we want to invert both axes.

As I understand it, lcd_rotate reprograms the panel to change the orientation, which is more efficient than rotating the framebuffer, but I can see why it may not work for an arbitrary display.

You may instead be able to tell the Linux/X input system to invert both axes.

Robin466
Posts: 29
Joined: Tue May 08, 2018 5:55 am
Location: Fryslân, The Netherlands

Re: ads7846 on spi1

Fri May 11, 2018 12:12 pm

guys thank you both for you amazing support i really appreciate it :)

but the solution to this problem was super simple, just as simple as just calibrating the touchscreen :oops:

everything is working fine now, and this methode is proving to be working !

cheers,

Robin

Return to “Device Tree”