Closed sudobrew closed 3 years ago
I was thinking, since I have the custom image from waveshare, is there an easy way to extract the initialization sequence if I temporarily load the image on the raspberry pi?
Do you know if they use fbtft? Try:
$ dmesg | grep graphics
graphics fb1: XXX frame buffer, 480x272, 255 KiB video memory, fps=20
If they do, what does lsmod
show?
Thank you for the response
$dmesg | grep graphics
fb1: flexb frame buffer, 480x320, 300kiB video memory, 4 kiB DMA buffer memory, fps=20, spi0.0 at 16MHz
$lsmod
Module Size Used by
joydev 9096 0
ads7846 8513 0
ads7846_device 6125 0
fbtft_device 28475 0
flexfb 14028 3
fbtft 31542 2 flexfb,fbtft_device
syscopyarea 3039 1 fbtft
sysfillrect 3349 1 fbtft
sysimgblt 2154 1 fbtft
fb_sys_fops 1455 1 fbtft
i2c_dev 6886 0
snd_bcm2835 18169 0
snd_soc_pcm512x 8909 0
snd_soc_wm8804 7833 0
snd_soc_bcm2708_i2s 5486 0
regmap_mmio 2818 1 snd_soc_bcm2708_i2s
snd_soc_core 146286 3 snd_soc_pcm512x,snd_soc_wm8804,snd_soc_bcm2708_i2s
snd_compress 12419 1 snd_soc_core
regmap_i2c 1657 3 snd_soc_pcm512x,snd_soc_wm8804,snd_soc_core
snd_pcm_dmaengine 5481 1 snd_soc_core
regmap_spi 1913 3 snd_soc_pcm512x,snd_soc_wm8804,snd_soc_core
snd_pcm 81542 3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_page_alloc 5168 1 snd_pcm
snd_seq 54581 0
snd_seq_device 6485 1 snd_seq
snd_timer 20353 2 snd_pcm,snd_seq
evdev 10485 4
leds_gpio 2055 0
snd 61526 7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
led_class 4378 1 leds_gpio
i2c_bcm2708 4719 0
spi_bcm2708 8004 0
I then ran:
$dmesg | grep spi
fbtft_request_gpios: 'reset' =GPIO025
fbtft_request_gpios: 'dc' =GPIO024
flexfb_verify_gpios_dc()
fbtft_init_display()
fbtft_reset()
init: write(0xB0) 0x00
init: write(0x11)
init: mdelay(250)
init: write(0x3A) 0x55
init: write(0xC2) 0x44
init: write(0xC5) 0x00 0x00 0x00 0x00
init: write(0xE0) 0x0F 0x1F 0x1C 0x0C 0x0F 0x08 0x48 0x98 0x37 0x0A 0x13 0x04 0x11 0x0D 0x00
init: write(0xE1) 0x0F 0X32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
init: write(0xE2) 0x0F 0X32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00
init: write(0x36) 0x28
init: write(0x11)
init: write(0x29)
Display update: 1691kB/s (177.354ms),fps=0 (0.000 ms)
fbtft_register_backlight()
fbtft_register_backlight(): led pin not set, exiting
graphics fb1: flexb frame buffer, 480x320, 300kiB video memory, 4 kiB DMA buffer memory, fps=20, spi0.0 at 16MHz
fbtft_device: spidev spi0.1 500kHZ 8 bits mode=0x00
fbtft_device: flexfb spi0.0 16000kHZ 8 bits mode=0x00
ads7846_device: Deleting spi0.1
ads7846 spi0.1: touchscreen, irq 187
input ADS7846 Touchscreen as /devices/platform/bcm2708_spi.0/spi_master/spi0/spi0.1/input/input1
Interesting to see that they use 24 and 25 which is different than their documentation
modprobe flexfb width=320 height=480 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
modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24
Thank you fergie4000! That worked perfectly!
I grabbed the config.txt and cmdline.txt from the factory image and added these lines to my configs:
config.txt
gpu_mem=128
cmdline.txt
fbcon=map:1 fbcon=font:ProFont6x11
Not a problem. Recently went through this trying to get the same screen working on my Raspi.
I now have this display running on both Raspbian and Raspbmc although often the Raspbmc display goes a bit funny. I'm trying to sort that out before i even attempt to get touch working on Raspbmc.
Hello folks :) I just purchased one of these Waveshare 3.5" displays and am also having issues getting it running on my B+. I'm running Rasberian as I do not want to use the supplied image. I tried running the commands in the shell that fergie4000 suggested, but still just get a blank white display. Is there something else I need to do? I've run a firmware update, but I don't see the fbtft folder in my /sys/module. How do I go about getting it installed?
Here are the steps that I took to get it working. The screen should start working at step 5 when you do the test.
1.Expand the filesystem
sudo raspi-config
2.Change fb0 to fb1
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
3.Enable SPI if needed
# remove or comment out the spi blacklist line
sudo nano /etc/modprobe.d/raspi-blacklist.conf
4.FBTFT drivers as loadable modules
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
sudo reboot
5.Test
sudo modprobe flexfb width=320 height=480 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
sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24
6.Perminantly add Driver
#Add to file /etc/modules
flexfb width=320 height=480 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=90 name=flexfb speed=16000000 gpios=reset:25,dc:24
7.Additional settings
#config.txt
gpu_mem=128
#cmdline.txt
fbcon=map:1 fbcon=font:ProFont6x11
When I run the second command in step 5, I get this error:
ERROR: could not insert 'fbtft_device': Invalid argument
Any ideas?
This will probably tell you why:
$ dmesg | tail
fbtft_device writes messages to the kernel log.
Sorry for delay, had to run to work. This is what I get: dmesg | tail [ 26.790736] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 [ 30.811120] bcm2835-cpufreq: switching to governor ondemand [ 30.811160] bcm2835-cpufreq: switching to governor ondemand [ 35.085853] wlan0: authenticate with 6c:aa:b3:11:ac:38 [ 35.174888] wlan0: send auth to 6c:aa:b3:11:ac:38 (try 1/3) [ 35.176448] wlan0: authenticated [ 35.178121] wlan0: associate with 6c:aa:b3:11:ac:38 (try 1/3) [ 35.183354] wlan0: RX AssocResp from 6c:aa:b3:11:ac:38 (capab=0x431 status=0 aid=1) [ 35.198350] wlan0: associated [ 35.323892] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
Also, would it matter if I was running this in a putty session? Will it still enable the screen on the unit?
You have to load fbtft_device first (sudo modprobe ...). Then run dmesg and give me the part containing fbtft related messages (skip tail, it might drop the first messages).
Also, would it matter if I was running this in a putty session? Will it still enable the screen on the unit?
That works fine.
For some reason my OS isn't booting anymore, I'm going to do a fresh Raspberian install to the SD card and try the steps Sudobrew has listed. I was trying them in the exact order listed, but still hung on on line two in step 5 with that error message.
And it appears that I was running NOOBS. I'm going to reload it with Raspberian only.
Well, I have made some progress... the screen is no longer white, it is now black (backlight is on). I can see it initalize when booting up the unit, just doesn't show anything on it.
Here's a full dmesg for you. Any ideas? Incoming wall of text:
dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.12.34+ (pi@raspi2) (gcc version 4.8.3 20140106 (p rerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) ) #1 PR EEMPT Sun Dec 7 22:39:06 CET 2014
[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr =00c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruc tion cache
[ 0.000000] Machine: BCM2708
[ 0.000000] cma: CMA: reserved 8 MiB at 17800000
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] On node 0 totalpages: 98304
[ 0.000000] free_area_init_node: node 0, pgdat c0662838, node_mem_map c071b00 0
[ 0.000000] Normal zone: 768 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 98304 pages, LIFO batch:31
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pag es: 97536
[ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1680 bcm2708_fb.fbheight=1050 bcm2708.boardrev=0x10 bcm2708.serial=0xccdc23b4 smsc95x x.macaddr=B8:27:EB:DC:23:B4 bcm2708_fb.fbswap=1 bcm2708.disk_led_gpio=47 bcm2708 .disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0 x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,11520 0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 374204K/393216K available (4636K kernel code, 266K rwdata , 1476K rodata, 147K init, 710K bss, 19012K reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xd8800000 - 0xff000000 ( 616 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xd8000000 ( 384 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc06003d8 (6113 kB)
[ 0.000000] .init : 0xc0601000 - 0xc0625e84 ( 148 kB)
[ 0.000000] .data : 0xc0626000 - 0xc0668a38 ( 267 kB)
[ 0.000000] .bss : 0xc0668a44 - 0xc071a328 ( 711 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] NR_IRQS:394
[ 0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4 294967ms
[ 0.000000] Switching to timer-based delay loop
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] console [tty1] enabled
[ 0.001170] Calibrating delay loop (skipped), value calculated using timer fr equency.. 2.00 BogoMIPS (lpj=10000)
[ 0.001227] pid_max: default: 32768 minimum: 301
[ 0.001738] Mount-cache hash table entries: 512
[ 0.002577] Initializing cgroup subsys memory
[ 0.002685] Initializing cgroup subsys devices
[ 0.002723] Initializing cgroup subsys freezer
[ 0.002755] Initializing cgroup subsys blkio
[ 0.002902] CPU: Testing write buffer coherency: ok
[ 0.003349] Setting up static identity map for 0xc046b378 - 0xc046b3d4
[ 0.006608] devtmpfs: initialized
[ 0.022740] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[ 0.024323] NET: Registered protocol family 16
[ 0.029670] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[ 0.030471] cpuidle: using governor ladder
[ 0.030524] cpuidle: using governor menu
[ 0.030958] bcm2708.uart_clock = 0
[ 0.032773] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[ 0.032828] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.032862] mailbox: Broadcom VideoCore Mailbox driver
[ 0.032958] bcm2708_vcio: mailbox at f200b880
[ 0.033082] bcm_power: Broadcom power driver
[ 0.033121] bcm_power_open() -> 0
[ 0.033146] bcm_power_request(0, 8)
[ 0.533872] bcm_mailbox_read -> 00000080, 0
[ 0.533915] bcm_power_request -> 0
[ 0.534175] Serial: AMBA PL011 UART driver
[ 0.534341] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev3
[ 0.898896] console [ttyAMA0] enabled
[ 0.925501] bio: create slab
[ 2.438622] mmcblk0: p1 p2 [ 2.447281] [vc_sm_connected_init]: end - returning 0 [ 2.543158] usb 1-1: new high-speed USB device number 2 using dwc_otg [ 2.554589] Indeed it is in host mode hprt0 = 00001101 [ 2.763430] usb 1-1: New USB device found, idVendor=0424, idProduct=9514 [ 2.774935] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2.787715] hub 1-1:1.0: USB hub found [ 2.796388] hub 1-1:1.0: 5 ports detected [ 3.083183] usb 1-1.1: new high-speed USB device number 3 using dwc_otg [ 3.166085] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. O pts: (null) [ 3.179402] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 3.191637] devtmpfs: mounted [ 3.199835] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00 [ 3.211921] Freeing unused kernel memory: 144K (c0601000 - c0625000) [ 3.222993] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber =0 [ 3.238494] smsc95xx v1.0.4 [ 3.306834] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1 .1, smsc95xx USB 2.0 Ethernet, b8:27:eb:dc:23:b4 [ 3.403182] usb 1-1.3: new low-speed USB device number 4 using dwc_otg [ 3.637528] usb 1-1.3: New USB device found, idVendor=04f2, idProduct=0408 [ 3.649414] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber =0 [ 3.661676] usb 1-1.3: Product: USB Keyboard [ 3.670857] usb 1-1.3: Manufacturer: Chicony [ 3.738585] input: Chicony USB Keyboard as /devices/platform/bcm2708_usb/usb1 /1-1/1-1.3/1-1.3:1.0/input/input0 [ 3.754320] hid-generic 0003:04F2:0408.0001: input,hidraw0: USB HID v1.11 Key board [Chicony USB Keyboard] on usb-bcm2708_usb-1.3/input0 [ 3.912298] input: Chicony USB Keyboard as /devices/platform/bcm2708_usb/usb1 /1-1/1-1.3/1-1.3:1.1/input/input1 [ 3.929274] hid-generic 0003:04F2:0408.0002: input,hiddev0,hidraw1: USB HID v 1.11 Device [Chicony USB Keyboard] on usb-bcm2708_usb-1.3/input1 [ 5.645422] udevd[159]: starting version 175 [ 6.645977] bcm2708_i2c_init_pinmode(1,2) [ 6.856473] bcm2708_i2c_init_pinmode(1,3) [ 6.973615] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000) [ 7.238687] bcm2708_spi bcm2708_spi.0: DMA channel 2 at address 0xf2007200 wi th irq 77 [ 7.375886] bcm2708_spi bcm2708_spi.0: DMA channel 4 at address 0xf2007400 wi th irq 20 [ 7.534215] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80) [ 7.693205] bcm2708_spi bcm2708_spi.0: SPI Controller running in dma mode [ 9.105772] pcm512x 1-004d: Failed to reset device: -5 [ 9.251016] pcm512x: probe of 1-004d failed with error -5 [ 9.312524] pcm512x 1-004c: Failed to reset device: -5 [ 9.392528] pcm512x: probe of 1-004c failed with error -5 [ 16.723421] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 18.294735] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 19.396145] fbtft_device: SPI devices registered: [ 19.406732] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 [ 19.418842] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 19.430762] fbtft_device: 'fb' Platform devices registered: [ 19.441991] fbtft_device: bcm2708_fb id=-1 pdata? no [ 19.453086] fbtft_device: Deleting spi0.0 [ 19.466341] flexfb spi0.0: fbtft_request_gpios: 'reset' = GPIO25 [ 19.493306] flexfb spi0.0: fbtft_request_gpios: 'dc' = GPIO24 [ 19.510556] flexfb spi0.0: flexfb_verify_gpios_dc() [ 19.521086] flexfb spi0.0: fbtft_init_display() [ 19.531236] flexfb spi0.0: fbtft_reset() [ 19.660639] flexfb spi0.0: init: write(0xB0) 0x00 [ 19.670932] flexfb spi0.0: init: write(0x11) [ 19.680658] flexfb spi0.0: init: mdelay(250) [ 19.999647] flexfb spi0.0: init: write(0x3A) 0x55 [ 20.009899] flexfb spi0.0: init: write(0xC2) 0x44 [ 20.020022] flexfb spi0.0: init: write(0xC5) 0x00 0x00 0x00 0x00 [ 20.031411] flexfb spi0.0: init: write(0xE0) 0x0F 0x1F 0x1C 0x0C 0x0F 0x08 0x 48 0x98 0x37 0x0A 0x13 0x04 0x11 0x0D 0x00 [ 20.047623] flexfb spi0.0: init: write(0xE1) 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x 47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 [ 20.063735] flexfb spi0.0: init: write(0xE2) 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x 47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 [ 20.079736] flexfb spi0.0: init: write(0x36) 0x28 [ 20.089544] flexfb spi0.0: init: write(0x11) [ 20.098871] flexfb spi0.0: init: write(0x29) [ 20.274898] flexfb spi0.0: Display update: 1797 kB/s (166.776 ms), fps=0 (0.0 00 ms) [ 20.287578] flexfb spi0.0: fbtft_register_backlight() [ 20.297442] flexfb spi0.0: fbtft_register_backlight(): led pin not set, exiti ng. [ 20.313300] graphics fb1: flexfb frame buffer, 480x320, 300 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 16 MHz [ 20.332073] fbtft_device: GPIOS used by 'flexfb': [ 20.341789] fbtft_device: 'reset' = GPIO25 [ 20.350804] fbtft_device: 'dc' = GPIO24 [ 20.359415] fbtft_device: SPI devices registered: [ 20.368687] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 20.379425] fbtft_device: flexfb spi0.0 16000kHz 8 bits mode=0x00 [ 26.664730] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [ 30.326184] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 31.906097] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE 1 [ 36.917500] Adding 102396k swap on /var/swap. Priority:-1 extents:2 across:2 134012k SSFS
Update: So, the GUI works (if I run startx). But no display while outside of the gui.
Is there any way to display the system when not in gui?
Also, no touchscreen function. I know it uses the XPT2046 touch controller
Console Move console 1 to framebuffer 1: con2fbmap 1 1 Permanent: https://github.com/notro/fbtft/wiki/Boot-console#enable-console
Touch Example for a display with the same controller:
sudo modprobe ads7846_device model=7846 cs=1 speed=2000000 gpio_pendown=25 pressure_max=255 x_plate_ohms=60
https://github.com/notro/fbtft_tools/wiki/ads7846_device https://github.com/notro/fbtft/wiki/Touchpanel
Great! Thank you very much for the help Notro and Sudobrew!
Thank you for your help, I have the same Waveshare 3.5 Spotpear screen and I have 2 questions :
I have no xorg.config file, I think I have to modify xorg file but where is it in the last raspbian?
Please, help me...
I really need your help. I can't rotate my screen and I don't know how do it. My /etc/modules is like this (same on the top af this thread) :
flexfb width=320 height=480 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=90 name=flexfb speed=16000000 gpios=reset:25,dc:24
When I try to change rotate to rotate=180 or 270 I can see that something change on my screen if width and height don't change but each time, X11 is load in the same direction.
Please help me, please...
Notro, you made an raspian image for other screen. Do you have one for this screen ?
The flexfb driver doesn't have builtin rotation support. You have to change the init sequence as well as providing the rotation parameter (or just take care of swapping width/height yourself). width=320 height=480 and rotate=90 is equivalent to width=480 height=320 and rotate=0
Register 0x36 controls rotation
init=[...],-1,0x36,0x28,[...]
I believe this is a MIPI compatible register, so this driver can be used as an example for the various bit fields: https://github.com/notro/fbtft/blob/master/fb_ili9341.c#L100 The values for this register can differ between panels.
You can try asking the seller for the values.
Notro, you are my god and receive a very big thank you.
I wasn't easy, I tried a lot of value because it depend of width, height and rotate in fbtft_device. I found the good value : register 0x36, value 0x48 with rotate = 0 in fbtft_device.
flexfb width=320 height=480 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,0x48,-1,0x11,-1,0x29,-3
fbtft_device debug=3 rotate=0 name=flexfb speed=16000000 gpios=reset:25,dc:24
Now I have to configure touchscreen. drkrieger01 or sudobrew, could you explain how did you configure it?
To finish, here touchscreen config : A good link : http://cooljc.me.uk/?page_id=14
sudo apt-get -y install xinput evtest libts-bin
Edit /etc/modules
# Touchscreen
ads7846_device model=7846 cs=1 gpio_pendown=17 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900
If you want a vertical mode, you can take this configuration :
pi@rasp ~ $ sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf Section "InputClass" Identifier "calibration" MatchProduct "ADS7846 Touchscreen" Option "Calibration" "3869 178 3903 270" EndSection
If you need to recalibrate for other orientation, you can use xinput_calibrator :
wget http://adafruit-download.s3.amazonaws.com/xinput-calibrator_0.7.5-1_armhf.deb
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb
Before to start it, you have to delete (if exist) /usr/share/X11/xorg.conf.d/99-calibration.conf.
sudo reboot.
DISPLAY=:0.0 xinput_calibrator
After calibration, this tools give you informations usefull to create you own /usr/share/X11/xorg.conf.d/99-calibration.conf witdh your calibration.
Enjoy,
Thanks for this thread! It works for Waveshare 4inch LCD on raspberry pi v2. You saved my day :)
@twkrol can you speak to specifically which instructions you followed? I'm also working on a Waveshare 4inch LCD with RPi 2. I followed the instructions (twice) with a fresh install of Raspbian, and after reboot I can't hit the pi via SSH or get the HDMI display to show me anything. So clearly, I'll be starting over again. Ha!
@mikertr I've follwed instructions from http://www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi/#content. But use flexfb device instead of waveshare32b. Keep the configuration of touch, but have to calibrate 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 :)
@twkrol Thanks And can you tell me what do you have in your /boot/cmdline.txt file? because when I modify mine, my rpi2 won't boot anymore
Here it is:
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
@twkrol Thanks a lot :)
Just one more thing: can I have display on both HDMI & LCD screen at the same time?
@twkrol Thank you for the write up and quick reply. I'm hoping to give this a shot in the next day or two. Will report back.
Hi,
Anybody knows how turn off backlight? I would like to turn off after 10 min. I tried some tips but nothing works. Tx,
@twkrol
Whait is your touch screen calibration config ? Can u give your /etc/modules file plz?
Hi Please find 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
I followed @sudobrew's steps/instructions and I also had the issue of "ERROR: could not insert 'fbtft_device': Invalid argument"
In case anyone else has the same issue, just to let you know that on step 3
3.Enable SPI if needed
'# remove or comment out the spi blacklist line sudo nano /etc/modprobe.d/raspi-blacklist.conf
Well, what I have done, in order to enable the SPI, was to change it from "sudo raspi-config" as well (not only to comment out the spi blacklist line as described)
Thanks to @notro for his great work and to @sudobrew for summing up all the required steps!
@twkrol Thank you but it's strange ... Even with your etc/modules file my touch screen isn't calibrated...
@pykoon
Anybody knows how turn off backlight? I would like to turn off after 10 min. I tried some tips but nothing works.
For console the backlight turns off on the second blanking event, not the first. There has been a change to the backlight core that isn't reflected in fbtft. https://github.com/notro/fbtft/wiki/Boot-console#console-blanking
This is a workaround for X windows: https://github.com/notro/fbtft-spindle/wiki/Appendix#x-windows-backlight-script
@notro Tx for your response.
However, it doesn't work on my pi; I followed your guide "X windows backlight script" and now, I have a pretty screen saver but blanking doesn't work. I'm note sure but I have nothing in /sys/class/backlight so I don't understand how "echo 4 | sudo tee /sys/class/backlight/*/bl_power 1>/dev/null" will work.
Do you have an idea of my problem?
Tx,
Do you have anything in /sys/class/backlight ? The 'led' gpio enables FBTFT backlight control. I remember someone asking about a Waveshare display and backlight, maybe there isn't any backlight control on this display?
@notro
I have nothing in /sys/class/backlight. I already tried to contact waveshare but they don't respond. I will try again.
Tx for your analyze.
Resolved please read after ---------
Thanks everyone for the effort in putting this together, I was able to successfully get my screen to display but as soon as I did this command:
sudo apt-get -y install xinput evtest libts-bin
and rebooted my screen no longer works it only just flashes, sometimes i see a faint image of my desktop but then it disappears. Any ideas? I was just trying to get the touch screen functionality to work and now I can't even return to the way it was before.
I also tried apt-get remove on that and it still didn't bring me back to where I could at least use the screen as a display device so it much have changed something...
I apologize it seems my LCD screen might be defective I took it out and put it back on and tightened the ribbon and it seems to be working now including the touch screen after i reinstalled that stuff. However when i move my finger left the mouse goes right. Up and down is correct though
I had a lot of trouble getting the 'Waveshare Spotpear 3.5 A' touch screen to work. The controller is XPT2046, which is the same as ads7843, not ads7846! Change the device_model argument to 7843
, and it works!
ads7846_device model=7843 irq=187 cs=1 gpio_pendown=17 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900
Hm I changed the device to 7843 but it didn't appear to make an ounce of difference, no matter what configuration I do from twkrol's post I always end up with one axis which is backwards.
I have the waveshare spotpear 3.5 no idea about a letter after it.
Edit:
Ok so I used xinput-calibrator which makes it so the touchscreen works just fine, I'm not sure why the post above said to remove /usr/share/X11/xorg.conf.d/99-calibration.conf. If I do that I can no longer switch to HDMI output but it seems to calibrate just fine even if you leave the file.
Only issue now is I have no idea how to make the calibration permanent, currently I need to rerun the application upon every startup. Anyone know how to do that?
@twkrol I've attempted to follow the steps you took and seem to run off the rails on step one, switching fb0/fb1 in /usr/share/X11/xorg.conf.d/99-fbturbo.conf. Upon reboot, I consistently get a kernel panic message (on my HDMI display, mind you. Not the LCD). Last line says "end Kernel panic - not syncing: Fatal exception in interrupt".
I detached the LCD and followed the rest of the steps, hoping to re-attach the LCD and reboot. Upon doing so, my kernel panic message is "not syncing: VFS: Unable to mount root fs on unknown-block (179,6).
I'm about to dropkick this thing into a nearby lake.
@twkrol update - a silly error on my part in the cmdline file earned me the second kernel panic message (got some bad advice on another forum), so I feel like I've at least made some progress. Upon reboot, I'm not seeing either kernel panic message.
When booting, I now receive:
Loading kernel module snd-bcm2835. Loading kernel module flexfb. Loading kernel module fbtft_device. fbtft_device: SPI devices registered: fbtft_device: 'fb' Platform devices registered: fbtft_device: bcm2708_fb id=-1 pdata? no fbtft_device: spi_nusnum_to_master(0) returned NULL fbtft_device: failed to register SPI device ERROR: could not insert 'fbtft_device': Invalid argument
I feel like I'm making some progress but missing something fairly obvious. Thoughts?
@mikertr Let's try on fresh raspian install. Do you have enabled the SPI in raspian config? If the problem presists, please post your /etc/modules for review.
Attempt on fresh raspbian install gave me the same results, though I fear I'm probably making the same mistakes. Here's my /etc/modules
snd-bcm2835
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
@mikertr Go add in your /etc/modules the following line:
spi-bcm2708
just after
snd-bcm2835
Hello, I have been attempting to set up a Waveshare 3.5 Spotpear , but all I have been getting is a blank bright white screen. I'm was hoping someone with a bit more experience would have more insight.
http://www.amazon.com/Waveshare-Raspberry-Resistive-Interface-Rapsberry-pi/dp/B00OZLG2YS
From the manufacturer: 1,17 - 3.3V 2,4 - 5V 3,5,7,8,10,12,13,15,16 - NC 6,9,14,20,25 - GND 11 - TP_IRQ (Touch Panel interrupt) 18 - LCD_RS (Instructions / Data Register Selection) 19 - LCD_SI / TP_SI (SPI data input) 21 - TP_SO (SPI data output) 22 - RST (Reset) 23 - LCD_SCK / TP_SCK (SPI clock) 24 - LCD_CS (LCD chip selection) 26 TP_CS (Touch Panel chip selection)
I have tried a few variations of: sudo modprobe fbtft_device custom name=fb_ili9341 speed=48000000 gpios=dc:18,reset:22 bgr=1 rotate=270 width=480 height=320
But so far all I get is the HDMI to freeze and the LCD remains bright white.
I was following this forum: https://github.com/notro/rpi-firmware/issues/6 but the solutions provided don't seem to work with this different display. I have the image provided from the manufacturer, but I would rather use the standard Raspian image.