Freakstreet
Posts: 3
Joined: Mon Oct 19, 2015 1:55 pm

LCD driver at boot

Mon Oct 19, 2015 2:14 pm

Hi all,

I'm new here and being struggling to have my WaveShare 4" LCD working.
From several tutos and forums, i managed to have the display working ... more or less.

I detail my work :

I use the official 2015-09-24-raspbian-jessie.img image on a Raspberry Pi2 B model

1 - I enable the SPI using the GUI tool (or raspi_config)
2 - I test my TFT driver with the following lines :

Code: Select all

sudo modprobe 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
sudo modprobe fbtft_device name=flexfb speed=16000000 gpios=reset:25,dc:24
After the second line, the display gets initialised (goes from white to black)

While using the LCD as output, the console get displayed correctly on it.

Code: Select all

con2fbmap 1 1
The second step was to automatically load the driver, so I've added the two previous lines in the /etc/modules file

Code: Select all

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
And there is my issue :?: , after reboot, the LCD doesn't get initialised. Hopefully I haven't updated yet the /boot/cmdline.txt yet and kep booting on the HDMI display. If i entre the two "modprobe flex..." lines detailled first, the display gets initialised.

The next steps will be switching from the HDMI to the TFT at bootup :

Code: Select all

# set the LCD as default display even at boot, to the end of the line add the arguments
sudo leafpad /boot/cmdline.txt
add --> "fbcon=map:1 fbcon=font:ProFont6x11"
# to load the windows manager on the LCD, add the line in the 99-fturbo.fconf file
sudo leafpad /usr/share/X11/xorg.conf.d/99-fbturbo.conf
--> switch fb0 to fb1
Does anyone have had this experience with this issue ? Any comment would be a great help.
Thanks in advance.

Regards,

Freakstreet
Posts: 3
Joined: Mon Oct 19, 2015 1:55 pm

Re: LCD driver at boot

Tue Oct 20, 2015 6:28 am

After checking with dmesg, the drivers weren't loaded at all during boot sequence.
I've tried with the 2015-05-05-raspbian-wheezy.img, and everything wokrs well.
SInce it works this way, I won't go farther in exploration but i regret not understanding what was happening with the jessie version.

lema67
Posts: 1
Joined: Wed Oct 28, 2015 6:23 pm

Re: LCD driver at boot

Wed Oct 28, 2015 6:33 pm

Hey the same by me @ Jessie
.
I have a workaround for me found.
Put your driver-init in a file :
/usr/local/bin/loaddisplay

loaddisplay: (for my Display)

Code: Select all

#!/bin/bash

modprobe fbtft_device name=flexfb gpios=dc:22,reset:27 speed=48000000 
modprobe flexfb width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3
and load this over the rc.local

rc.local:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/usr/local/bin/loaddisplay

exit 0
Here my modules:

Code: Select all

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

snd-bcm2835
and my /boot/config.txt

Code: Select all

dtparam=spi=on
dtoverlay=rpi-display
regards lema67

Gor
Posts: 9
Joined: Tue Jan 12, 2016 4:44 pm

Re: LCD driver at boot

Wed Jan 13, 2016 8:53 pm

To autoload modules on Jessie you need to use /etc/mod probe.d

Details are here: viewtopic.php?p=883123#p883123

Return to “Troubleshooting”