0

I'm trying to configure waveshare 35b touchscreen on raspberry 3. I have 2 problems :

  • slow refresh rate
  • inverted colors (black is white)

Here is my config, (I do not need touchscreen, so it is not configured) :

in config.txt
# enable touchscreen over SPI
device_tree_param=spi=on
dtoverlay=waveshare35b


cat /etc/modules-load.d/touchscreen.conf 
spi-bcm2835
flexfb
fbtft_device

cat /etc/modprobe.d/fbtft.conf 
options flexfb 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
options fbtft_device name=flexfb speed=8000000 gpios=reset:25,dc:24 fps=60 txbuflen=32768

cat /etc/X11/xorg.conf.d/99-fbdev-tft35.conf 
Section "Device"
  #WaveShare SpotPear 3.5", framebuffer 1
  Identifier "WaveShare3.5"
  driver "fbdev"
  Option "fbdev" "/dev/fb1"
  Option "ShadowFB" "off"
EndSection

I've tried many configurations :

  • changing fbtft_device speed
  • using other overlay (piscreen)
  • test fbtft_device bgr option

But in all cases color are inverted and refresh rate is very slow.

Here is my kernel :

uname -a
Linux a4h-rpi-coffee-machine 4.14.62-1-ARCH #1 SMP Fri Aug 17 05:43:55 UTC 2018 armv7l GNU/Linux

Something is unclear for me, in waveshare35b overlay we can see waveshare35b values for parameters init fps

these parameters are also set in /etc/modprobe.d/fbtft.conf for flexfb configuration. It would appear that loading and configuring flexfb fbtft_device is meaningless. waveshare35b overlay already loads and configure touchscreen. But when I remove /etc/modules-load.d/touchscreen.conf and /etc/modprobe.d/fbtft.conf no driver is loaded.

dmesg |grep graphics
dmesg |grep spi

does not return anything.

Moreover waveshare35b is not in device tree :

sudo ls -R /sys |grep wave

returns nothing. I've recompiled dtbo and copied it to /boot/overlays but it did not change anything.

EDITED : Many thanks @Dirk I've also tried to check logs with vcdbg (to get it on arch :

wget -O vcdbg 'https://github.com/raspberrypi/firmware/blob/master/hardfp/opt/vc/bin/vcdbg?raw=true' && chmod 0755 vcdbg

and got :

002173.385: Failed to load overlay 'waveshare35b'
002173.484: brfs: File read: /mfs/sd/overlays/waveshare35b.dtb
003251.012: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
003361.706: Device tree loaded to 0x2eff9900 (size 0x66b6)

Now I'm investigating it.

bumped to the homepage by Community 12 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • I find it odd that you use a waveshare overlay an also load flexfb / fbtft modules explicitly. Which OS + version do you use and where did you get the overlay? – Dirk Sep 4 '18 at 14:22
  • Sure, for me it is meaningless, I use waveshare35b overlay from here github.com/swkim01/waveshare-dtoverlays but it seems that it is not loaded. Distro is arch, kernel 4.14 (all these info are provided in original post) – rem Sep 4 '18 at 14:27
  • uname does not show distro. Anybody can put 'arch' in the version... In the meantime you could use sudo vcdbg log msg to see if the overlay is loaded or not. (assuming you have vcdbg available on arch) – Dirk Sep 4 '18 at 14:38
  • Thanks for vcdbg tip, unfortunately, it is not available on arch. – rem Sep 4 '18 at 15:04
  • Many thanks Dirk, I installed wcdbg manually and edited the post with log results. I'm making progress... – rem Sep 4 '18 at 15:13
0

SOLUTION :

Loading manually:

spi-bcm2835
flexfb
fbtft_device

is meaningless. You just have to load waveshare35b in device tree, it will load

spi-bcm2835
flexfb
fbtft_device

with correct parameters. So you just have to follow steps described [here][2]

I was unable to load waveshare35b as we can see in first EDIT vcdbg logs. Problem was waveshare35b overlay name, I got a /boot/overlays/waveshare35b-overlay.dtbo if you load waveshare35b in config.txt, it must be /boot/overlays/waveshare35b.dtbo

Now, overlay is loaded as we can see :

sudo ./vcdbg log msg 2>&1 |grep wave
002167.283: brfs: File read: /mfs/sd/overlays/waveshare35b-overlay.dtb
002182.544: Loaded overlay 'waveshare35b'

Now, screen colors are fine, screen fps is quite slow.

I tried to speed up display with this config :

dtoverlay=waveshare35b:speed=32000000,fps=60

no I get :

 dmesg |grep graphics                                                                                                                                                                                                                           
[    7.845964] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB buffer memory, fps=100, spi0.0 at 32 MHz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.