5

I've bought 4inch IPS LCD from WaveShare but cannot get it run on newest Raspberry PI 2. The original DVD comes with image which isn't compatible with RPI 2.

Tried to follow this manual but without success. My LCD is newer model and not covered by notro FBTFT drivers.

Any thoughts?

goldilocks
  • 58,859
  • 17
  • 112
  • 227
twk
  • 191
  • 1
  • 1
  • 7
  • 1
    im in the same boat will try to work this out when i have time and let you know if i come up with anything. if you have any luck getting a image or driver that works please let me know im trying to get retro pi working with this screen but no luck so far i am going to try it on my old b+ just to confirm the screen works as the only image provided is currently for that model –  Feb 17 '15 at 23:26
  • The image supplied with the waveshare spotpear 4 inch screen I have just received works out of the box with the pi2 but not the zero, I can supply the image if needed – john jones Jan 21 '16 at 20:34

5 Answers5

4

I've followed instructions from http://www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi/#content. But use flexfb device instead of waveshare32b. You may keep the configuration of touch device, but have to calibrate it or rotate screen to keep it as is.

Add modules in /etc/modules as below:

flexfb width=480 height=320 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3

fbtft_device debug=3 rotate=0 name=flexfb speed=16000000 gpios=reset:25,dc:24

Changing screen rotation is a bit tricky but possible. You have to modify value of register 0x36 at the end of init string (value 0x28 just after 0x36). In the example above there is 0x28, as well as rotate=0 below. This is for horizontal screen with power socket on upper side, touch inverted. You can try these combinations:

Reg 0x36 value | rotate value | result

0x28 | 0 | Horizontal (power socket on top)

0xF8 | 0 | Horizontal (power socket on bottom side), touch works well

0x48 | 90 | Vertical

0x84 | 90 | Vertical (opposite)

Above values are found by testing, may not be the best settings but works :)

This is my /boot/cmdline.txt file:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=flexfb fbtft_device.gpios=dc:24,reset:25 fbtft_device.bgr=1 fbtft_device.speed=16000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0

Note: The Noobs distribution of Raspbian installs the root filesystem to logical partition p6 rather than the second primary partition p2. The above change to /boot/cmdline.txt assumes the filesystem is on p2. If you are using Noobs and you get a kernel panic following reboot after this change, log in using Recovery Mode and edit the line above changing root=/dev/mmcblk0p2 to root=/dev/mmcblk0p6.

and my /etc/modules entry for touch device:

ads7846_device model=7846 cs=1 gpio_pendown=17 speed=1000000 keep_vref_on=1 swap_xy=1 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900

Full thread can be found there https://github.com/notro/fbtft/issues/215

twk
  • 191
  • 1
  • 1
  • 7
2

The manuel you used is not for a waveshare spotPear touchscreen, only a waveshare one. Try this one: http://diyhacking.com/raspberry-pi-touchscreen-lcd-tutorial/

1

I found a step-by-step forum that finally helped me... I have the 4inch Waveshare and a RPi B+ with Raspbian originally downloaded from the Raspberry page.

Update firmware with:

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update

Enable SPI in raspi-config.

sudo nano /etc/modules

flexfb nobacklight regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 width=480 height=320
fbtft_device name=flexfb speed=16000000 gpios=reset:25,dc:24

sudo nano /boot/cmdline.txt

Add:

fbcon=map:1 fbcon=font:ProFont6x11

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Change fb0 to fb1

sudo nano /boot/config.txt

Add line:

dtoverlay=ads7846,speed=500000,penirq=17,swapxy=1

sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf (Copy-paste)

Section "InputClass"      
Identifier      "calibration"     
MatchProduct    "ADS7846 Touchscreen"      
Option  "Calibration"  "3900 240 3900 240"      
EndSection
goldilocks
  • 58,859
  • 17
  • 112
  • 227
1

I have the 4" Spotpear IPS model and a RPi zero. Now with a current Raspian version (~2016), it is not necessary to use the notro firmware anymore and you can simply use the overlay provided here. Make sure you copy the overlay to /boot/overlays/waveshare35a-overlay.dtb (Kernel < 4.4) or /boot/overlays/waveshare35a.dtbo (Kernel >= 4.4). Add an overlay entry to /boot/config.txt:

dtoverlay=waveshare35a

If you have problems with screwed-up colors, try lowering the SPI speed. I had funky colors with 16MHz, but up to 14MHz worked ok:

dtoverlay=waveshare35a,speed=14000000

This should already give you /dev/fb1 for the LCD. You may then want to adjust your resolution to 480x320 in config.txt, using:

framebuffer_width=480
framebuffer_height=320

If you are using fbcp to copy fb1 content to fb1, you may also want to adjust the resolution of the HDMI display to 640x400 (tables here) using:

hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=2

This gives you an almost-filled screen. There is some blank space horizontally, but except that, it looks fine. It may sound intriguing to use a hdmi_cvt modeline to set the resolution to the proper 480x320, but found this to NOT work very well:

hdmi_cvt=480 320 60 1 0 0 0

To make the console readable, edit /boot/cmdline.txt and add:

fbcon=map:1 fbcon=font:ProFont6x11
Bim
  • 151
  • 3
-2

The display should come with a CD containing an IMG file, my 4" did. Write the IMG file to your SD card and start as normal. The write process may only work in a direct SD port, I had no luck in USB adapters.

  • 1
    The original poster already specified that the image on the DVD didn't work as it's not compatible with the Pi 2. – recantha Apr 20 '15 at 13:09