PDA

View Full Version : Waveshare 4inch touchscreen



efthk23
2017-04-24, 10:30
Hi all. After a lot of time of searching, I decided to make a thread asking for help. As you have read from the title, I want to make my waveshare touchscreen work with the picore player. I've read a lot of posts asking the same thing but they haven't found any solution. Could please, anyone that know how this might work, give me a how to guide? Thx in advance.

tcutting
2017-04-24, 12:02
Hi all. After a lot of time of searching, I decided to make a thread asking for help. As you have read from the title, I want to make my waveshare touchscreen work with the picore player. I've read a lot of posts asking the same thing but they haven't found any solution. Could please, anyone that know how this might work, give me a how to guide? Thx in advance.

Looking at the Waveshare site, it looks like there are two different 4 inch screens - the 4inch RPi LCD which is 320x480 pixels and connects via SPI, and the 4inch HDMI LCD, which is 800x480 pixels and connects via HDMI. I have a screen very similar to the second one (but without the touch screen), and it works well since (1) it connects via HDMI and (2) it's the same resolution as the official rPi 7 inch display, so the JiveLite skins for this resolution just work. I assume you have the 320x480 SPI version?

paul-
2017-04-24, 16:57
In a previous message, he mentioned he is using the 4" spi version.


I'm assuming that you are trying to get jivelite working. First install jivelite, this will also install the Touchscreen kernel modules. In pCP 3.20, I've started to include the ads7846.ko module that waveshare uses as a touch interface.

First, I'm doing this all based on reading, the instructions http://www.waveshare.com/wiki/4inch_RPi_LCD_(A)#Driver I don't have a waveshare screen, so there is no way for me to troubleshoot.

You will need to download this to. http://www.waveshare.com/w/upload/7/74/LCD-show-170309.tar.gz Hopefully this is designed for the new 4.9.y kernels.

Once extracted, do not run the LCD4-show script......but you need to read what that script is doing.

The files of interest are

waveshare35a-overlay.dtb
-Copy this file to /mnt/mmcblk0p1/overlays/waveshare35a-overlay.dtbo
-and /mnt/mmcblk0p1/overlays/waveshare35a-overlay.dtb


The next files are the configs for orientation......look at the last lines of the file

boot/config-4.txt
boot/config-4.txt-90
boot/config-4.txt-180
boot/config-4.txt-270

depending on the orientation (This is the lines from config-4.txt) Add these lines to /mnt/mmcblk0p1/config.txt
dtoverlay=waveshare35a
dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,spe ed=1000000,keep_vref_on=1,swapxy=0,pmax=255,xohms= 60,xmin=200,xmax=3900,ymin=200,ymax=3900

After making the edits, reboot and see if the screen starts up......there is a chance that the screen will stay dark.....the key will be if /dev/fb1 is present on your system, there should also be some messages in dmesg. Lets see how this goes, before moving on.


Reminder, if you save files in your home directory, backup before rebooting (pcp bu)
/mnt/mmcblk0p1 is persistent, so backup is not needed here.

efthk23
2017-04-25, 08:49
Thx for your quick reply. I've done everything you suggested but the white screen is still there. when i type the dmesg command, it returns this many times: status 0x80000001
[ 351.495198] bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
[ 351.495204] bcm2708_fb_pan_display(0,0) returns=-22

I've also added the lines in the config.txt file. The /dev/fb1 file is not there. I've seen that the script "LCD-show" tries to install xserver. I attach the dmesg result.


22582



In a previous message, he mentioned he is using the 4" spi version.


I'm assuming that you are trying to get jivelite working. First install jivelite, this will also install the Touchscreen kernel modules. In pCP 3.20, I've started to include the ads7846.ko module that waveshare uses as a touch interface.

First, I'm doing this all based on reading, the instructions http://www.waveshare.com/wiki/4inch_RPi_LCD_(A)#Driver I don't have a waveshare screen, so there is no way for me to troubleshoot.

You will need to download this to. http://www.waveshare.com/w/upload/7/74/LCD-show-170309.tar.gz Hopefully this is designed for the new 4.9.y kernels.

Once extracted, do not run the LCD4-show script......but you need to read what that script is doing.

The files of interest are

waveshare35a-overlay.dtb
-Copy this file to /mnt/mmcblk0p1/overlays/waveshare35a-overlay.dtbo
-and /mnt/mmcblk0p1/overlays/waveshare35a-overlay.dtb


The next files are the configs for orientation......look at the last lines of the file

boot/config-4.txt
boot/config-4.txt-90
boot/config-4.txt-180
boot/config-4.txt-270

depending on the orientation (This is the lines from config-4.txt) Add these lines to /mnt/mmcblk0p1/config.txt
dtoverlay=waveshare35a
dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,spe ed=1000000,keep_vref_on=1,swapxy=0,pmax=255,xohms= 60,xmin=200,xmax=3900,ymin=200,ymax=3900

After making the edits, reboot and see if the screen starts up......there is a chance that the screen will stay dark.....the key will be if /dev/fb1 is present on your system, there should also be some messages in dmesg. Lets see how this goes, before moving on.


Reminder, if you save files in your home directory, backup before rebooting (pcp bu)
/mnt/mmcblk0p1 is persistent, so backup is not needed here.

paul-
2017-04-25, 09:17
Thx for your quick reply. I've done everything you suggested but the white screen is still there. when i type the dmesg command, it returns this many times: status 0x80000001
[ 351.495198] bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
[ 351.495204] bcm2708_fb_pan_display(0,0) returns=-22

I've also added the lines in the config.txt file. The /dev/fb1 file is not there. I've seen that the script "LCD-show" tries to install xserver. I attach the dmesg result.


Can you ask Waveshare if they support 4.9.y kernels yet. It sure would be nice if they just submit their overlays to rpi for inclusion in the standard kernel.

efthk23
2017-04-26, 02:04
They said that there is no support for 4.9 kernel only for 4.4. They also said that it doesn't matter which kernel version is supported.

piPlayer
2017-04-26, 05:54
Hello efthk23,

with the help of this two threads I get the Waveshare 4" TFT working well with jivelite.
I use Picoreplayer 3.02 with kernel 4.4.

Link 1 (https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiZ3qGRlMLTAhUDlSwKHesTDtsQrAIINygBMAA&url=http%3A%2F%2Fforum.tinycorelinux.net%2Findex.p hp%3Ftopic%3D19758.0&usg=AFQjCNFY3qGQkpfKp1W2d8bKJQSD3Q_9cw)
Link 2 (https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiZ3qGRlMLTAhUDlSwKHesTDtsQFggsMAA&url=http%3A%2F%2Fforum.tinycorelinux.net%2Findex.p hp%3Ftopic%3D18652.0&usg=AFQjCNGWuI6pR1M17BYwp4hKjJlaUejYeg)

I hope it helps you to.

piPlayer
2017-04-27, 01:45
...
I'm assuming that you are trying to get jivelite working. First install jivelite, this will also install the Touchscreen kernel modules. In pCP 3.20, I've started to include the ads7846.ko module that waveshare uses as a touch interface.
...

supplementary:
The module ads7846.ko is only for the touch interface.
To get the screen working the module fbtft.ko ist required. This module is standard in debian releases but not in PiCorePlayer based on TinyCore Linux. To get the module in PiCorePlayer you have to build in the module and recompile the kernel.
In my case I dont know how to recompile a kernel. So I build a .tcz extension that loads the module on startup.