User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

KeDei 3.5 inch 480x320 TFT lcd from ali

Mon Nov 02, 2015 9:25 pm

Hi,

I have came in possession :D of cheap (~14USD) 3,5" TFT LCD display with touch. On provided by seller sysimage lcd works ok but replaces HDMI.
This is the lcd module:
Image Image

While googling for any info about lcd controller I came across this page: http://heikki.virekunnas.fi/2015/raspberry-pi-tft/, author managed to get from manufacturer patch file for kernel sources and tested it with 4.1.y - on which lcd worked. But still LCD replace HDMI, but I want to use this screen as additional for user interaction, while the bigger on HDMI as presentation monitor.
I have looked through files that he (author of page `heikki.virekunnas.fi`) published, and I came to conclusion that the patch do not changes standard ILI9341 driver but only replace default framebuffer and directs it to ili driver while cutting out hdmi, only single mention in patch file about ili9341 is adding it's .ko file to $obj in makefile... wow I'm so smart :lol:

Since, fbtft has been merged with rpi kernel, so the fb drivers (including ili9341.c) was moved to fbtft_device driver (so the author of page can't compile latest kernel with driver+patch).
I tried to use fbtft but I just got "not supported driver" :(

I would be grateful for help making it works alongside with hdmi display...

I found the manufacturer on taobao https://kedei.taobao.com/ but I couldn't create account on taobao so I can't contact manufacturer....

Hardware
So something about hardware, which I reverse engineered by the "hard way" - "grab multimeter and run through all LCD FPC pins and shift register pins" :D

On board marking:

Code: Select all

KeDei
3.5 inch SPI TFTLCD
480x320 16/18bit
version 1.1 2015/8/11
On LCD - sticker:

Code: Select all

A35138N05QI
TW2C000094
29/9486L    PJ
Now I noticed there is "9486L" which can suggest that LCD screen is controlled by ILI9486L, I found this LCD on taobao too but I can't contact seller.

LCD - printed:

Code: Select all

BLU-A35138N05VI-A
PR3514-25 1227 1
On FPC of LCD:

Code: Select all

FPC-A35138S55VI-A
+ Date

Some photos:
Image Image Image
Image Image

And schematic draft & "human readable version" version :D :
Image
Image

I'm pretty sure about D/C (Pin 37 on LCD) and Reset (Pin 19 on LCD) pins by looking into driver code, but I can't identify other signals (WR/RD/CS/etc...)

The working sysimage
I have gathered some information form sysimage that is provided by seller:

dmesg just after boot.

Code: Select all

[email protected] ~ $ dmesg
[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.18.9-v7 ([email protected]) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #7 SMP PREEMPT Sun Jun 28 09:33:18 CST 2015
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: BCM2709
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 8081e640, node_mem_map ba093000
[    0.000000]   Normal zone: 1888 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (8600->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 10 pages/cpu @ba066000 s12224 r8192 d20544 u40960
[    0.000000] pcpu-alloc: s12224 r8192 d20544 u40960 alloc=10*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239776
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa01041 bcm2709.serial=0x2938b030 smsc95xx.macaddr=B8:27:EB:38:B0:30 bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 940800K/966656K available (5759K kernel code, 401K rwdata, 1760K rodata, 392K init, 771K bss, 25856K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0xbb800000 - 0xff000000   (1080 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x8075feb4   (7520 kB)
[    0.000000]       .init : 0x80760000 - 0x807c2000   ( 392 kB)
[    0.000000]       .data : 0x807c2000 - 0x808267f4   ( 402 kB)
[    0.000000]        .bss : 0x808267f4 - 0x808e77e4   ( 772 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:608
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (virt).
[    0.000015] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 3579139424256ns
[    0.000038] Switching to timer-based delay loop, resolution 52ns
[    0.000323] Console: colour dummy device 80x30
[    0.002069] console [tty1] enabled
[    0.002125] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.002222] pid_max: default: 32768 minimum: 301
[    0.002679] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002748] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.004077] Initializing cgroup subsys memory
[    0.004178] Initializing cgroup subsys devices
[    0.004241] Initializing cgroup subsys freezer
[    0.004298] Initializing cgroup subsys net_cls
[    0.004353] Initializing cgroup subsys blkio
[    0.004497] CPU: Testing write buffer coherency: ok
[    0.004618] ftrace: allocating 20075 entries in 59 pages
[    0.054619] missing device node for CPU 0
[    0.054700] missing device node for CPU 1
[    0.054732] missing device node for CPU 2
[    0.054762] missing device node for CPU 3
[    0.054803] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00
[    0.054845] [bcm2709_smp_prepare_cpus] enter
[    0.055017] Setting up static identity map for 0x52f398 - 0x52f3f0
[    0.114632] [bcm2709_boot_secondary] cpu:1 started (0) 18
[    0.114944] CPU1: Booted secondary processor
[    0.114950] [bcm2709_secondary_init] enter cpu:1
[    0.115005] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01
[    0.134622] [bcm2709_boot_secondary] cpu:2 started (0) 18
[    0.134876] CPU2: Booted secondary processor
[    0.134882] [bcm2709_secondary_init] enter cpu:2
[    0.134920] CPU2: thread -1, cpu 2, socket 15, mpidr 80000f02
[    0.154656] [bcm2709_boot_secondary] cpu:3 started (0) 18
[    0.154896] CPU3: Booted secondary processor
[    0.154903] [bcm2709_secondary_init] enter cpu:3
[    0.154938] CPU3: thread -1, cpu 3, socket 15, mpidr 80000f03
[    0.155038] Brought up 4 CPUs
[    0.155153] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.155191] CPU: All CPU(s) started in SVC mode.
[    0.156253] devtmpfs: initialized
[    0.182161] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.184364] pinctrl core: initialized pinctrl subsystem
[    0.185196] NET: Registered protocol family 16
[    0.190967] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.214447] cpuidle: using governor ladder
[    0.244479] cpuidle: using governor menu
[    0.245069] bcm2709.uart_clock = 3000000
[    0.247759] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.247817] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.247879] mailbox: Broadcom VideoCore Mailbox driver
[    0.248005] bcm2708_vcio: mailbox at f300b880
[    0.248410] bcm_power: Broadcom power driver
[    0.248451] bcm_power_open() -> 0
[    0.248480] bcm_power_request(0, 8)
[    0.749185] bcm_mailbox_read -> 00000080, 0
[    0.749220] bcm_power_request -> 0
[    0.749367] Serial: AMBA PL011 UART driver
[    0.749518] dev:f1: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev3
[    1.260280] console [ttyAMA0] enabled
[    1.338050] SCSI subsystem initialized
[    1.342071] usbcore: registered new interface driver usbfs
[    1.347735] usbcore: registered new interface driver hub
[    1.353197] usbcore: registered new device driver usb
[    1.360280] Switched to clocksource arch_sys_counter
[    1.395373] FS-Cache: Loaded
[    1.398632] CacheFiles: Loaded
[    1.413942] NET: Registered protocol family 2
[    1.419845] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    1.427091] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    1.433763] TCP: Hash tables configured (established 8192 bind 8192)
[    1.440238] TCP: reno registered
[    1.443521] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    1.449511] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    1.456255] NET: Registered protocol family 1
[    1.461128] RPC: Registered named UNIX socket transport module.
[    1.467075] RPC: Registered udp transport module.
[    1.471863] RPC: Registered tcp transport module.
[    1.476586] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.484235] bcm2708_dma: DMA manager at f3007000
[    1.489012] bcm2708_gpio: bcm2708_gpio_probe 807ed1d8
[    1.494891] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    1.504874] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    1.511385] audit: initializing netlink subsys (disabled)
[    1.516865] audit: type=2000 audit(1.289:1): initialized
[    1.538539] VFS: Disk quotas dquot_6.5.2
[    1.542906] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.552491] FS-Cache: Netfs 'nfs' registered for caching
[    1.558791] NFS: Registering the id_resolver key type
[    1.563973] Key type id_resolver registered
[    1.568174] Key type id_legacy registered
[    1.573491] msgmni has been set to 1853
[    1.579125] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.586856] io scheduler noop registered
[    1.590841] io scheduler deadline registered (default)
[    1.596347] io scheduler cfq registered
[    1.911108] input: KeDei.taobao.com as /devices/virtual/input/input0
[    2.321002] Console: switching to colour frame buffer device 60x40
[    2.334824] bcm2708-dmaengine bcm2708-dmaengine: Load BCM2835 DMA engine driver
[    2.346777] uart-pl011 dev:f1: no DMA platform data
[    2.360932] vc-cma: Videocore CMA driver
[    2.367043] vc-cma: vc_cma_base      = 0x00000000
[    2.373964] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    2.381573] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    2.401336] brd: module loaded
[    2.412768] loop: module loaded
[    2.418460] vchiq: vchiq_init_state: slot_zero = 0xba800000, is_master = 0
[    2.430724] Loading iSCSI transport class v2.0-870.
[    2.438790] usbcore: registered new interface driver smsc95xx
[    2.448962] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    2.659550] Core Release: 2.80a
[    2.664974] Setting default values for core params
[    2.672024] Finished setting default values for core params
[    2.882400] Using Buffer DMA mode
[    2.887990] Periodic Transfer Interrupt Enhancement - disabled
[    2.898264] Multiprocessor Interrupt Enhancement - disabled
[    2.908334] OTG VER PARAM: 0, OTG VER FLAG: 0
[    2.915053] Dedicated Tx FIFOs mode
[    2.922642] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xbac04000 dma = 0xfac04000 len=9024
[    2.937150] FIQ FSM acceleration enabled for :
[    2.937150] Non-periodic Split Transactions
[    2.937150] Periodic Split Transactions
[    2.937150] High-Speed Isochronous Endpoints
[    2.962548] dwc_otg: Microframe scheduler enabled
[    2.962659] WARN::hcd_init_fiq:412: FIQ on core 1 at 0x803df06c
[    2.972943] WARN::hcd_init_fiq:413: FIQ ASM at 0x803df3b8 length 36
[    2.983727] WARN::hcd_init_fiq:438: MPHI regs_base at 0xbb85e000
[    2.994358] dwc_otg bcm2708_usb: DWC OTG Controller
[    3.001665] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    3.013569] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    3.023730] Init: Port Power? op_state=1
[    3.029973] Init: Power Port (0)
[    3.035812] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    3.047205] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.059098] usb usb1: Product: DWC OTG Controller
[    3.066188] usb usb1: Manufacturer: Linux 3.18.9-v7 dwc_otg_hcd
[    3.076715] usb usb1: SerialNumber: bcm2708_usb
[    3.084692] hub 1-0:1.0: USB hub found
[    3.090856] hub 1-0:1.0: 1 port detected
[    3.097670] dwc_otg: FIQ enabled
[    3.097685] dwc_otg: NAK holdoff enabled
[    3.097696] dwc_otg: FIQ split-transaction FSM enabled
[    3.097744] Module dwc_common_port init
[    3.098246] usbcore: registered new interface driver usb-storage
[    3.109352] mousedev: PS/2 mouse device common for all mice
[    3.120453] bcm2835-cpufreq: min=600000 max=900000
[    3.128075] sdhci: Secure Digital Host Controller Interface driver
[    3.139119] sdhci: Copyright(c) Pierre Ossman
[    3.146142] DMA channels allocated for the MMC driver
[    3.190379] Load BCM2835 MMC driver
[    3.199000] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.209958] ledtrig-cpu: registered to indicate activity on CPUs
[    3.221012] hidraw: raw HID events driver (C) Jiri Kosina
[    3.228366] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.230524] mmc0: new high speed SDHC card at address 0007
[    3.231276] mmcblk0: mmc0:0007 SD8GB 7.42 GiB
[    3.233167]  mmcblk0: p1 p2
[    3.264962] usbcore: registered new interface driver usbhid
[    3.275539] usbhid: USB HID core driver
[    3.282323] TCP: cubic registered
[    3.288155] Initializing XFRM netlink socket
[    3.290504] Indeed it is in host mode hprt0 = 00021501
[    3.302591] NET: Registered protocol family 17
[    3.309727] Key type dns_resolver registered
[    3.317122] Registering SWP/SWPB emulation handler
[    3.325651] registered taskstats version 1
[    3.332536] vc-sm: Videocore shared memory driver
[    3.339645] [vc_sm_connected_init]: start
[    3.347002] [vc_sm_connected_init]: end - returning 0
[    3.470499] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    3.481920] Indeed it is in host mode hprt0 = 00001101
[    3.492098] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.505070] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    3.517157] devtmpfs: mounted
[    3.523192] Freeing unused kernel memory: 392K (80760000 - 807c2000)
[    3.680741] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    3.692598] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.706071] hub 1-1:1.0: USB hub found
[    3.712403] hub 1-1:1.0: 5 ports detected
[    4.000532] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    4.110793] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    4.122818] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    4.139259] smsc95xx v1.0.4
[    4.205350] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:38:b0:30
[    4.670786] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
[    4.782173] udevd[175]: starting version 175
[    4.787057] usb 1-1.3: New USB device found, idVendor=24ae, idProduct=1000
[    4.787071] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    4.787082] usb 1-1.3: Product: Rapoo 2.4G Wireless Touch Desktop
[    4.787091] usb 1-1.3: Manufacturer: MOSART Semi.
[    4.838806] input: MOSART Semi. Rapoo 2.4G Wireless Touch Desktop  as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:24AE:1000.0001/input/input1
[    4.862704] hid-generic 0003:24AE:1000.0001: input,hidraw0: USB HID v1.10 Keyboard [MOSART Semi. Rapoo 2.4G Wireless Touch Desktop ] on usb-bcm2708_usb-1.3/input0
[    4.902783] input: MOSART Semi. Rapoo 2.4G Wireless Touch Desktop  as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.1/0003:24AE:1000.0002/input/input2
[    4.926400] hid-generic 0003:24AE:1000.0002: input,hiddev0,hidraw1: USB HID v1.10 Mouse [MOSART Semi. Rapoo 2.4G Wireless Touch Desktop ] on usb-bcm2708_usb-1.3/input1
[    5.376850] bcm2708_i2c bcm2708_i2c.1: could not get IRQ
[    8.298303] random: nonblocking pool is initialized
[    9.458110] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    9.791195] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   15.253190] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   16.785108] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[   20.605736] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2101240k SSFS
lsmod - I didn't expect to find anything anyway...

Code: Select all

[email protected] ~ $ sudo lsmod
Module                  Size  Used by
snd_bcm2835            18739  0
snd_soc_bcm2708_i2s     6448  0
regmap_mmio             2961  1 snd_soc_bcm2708_i2s
snd_soc_core          139781  1 snd_soc_bcm2708_i2s
snd_compress            7579  1 snd_soc_core
snd_pcm_dmaengine       3335  1 snd_soc_core
snd_pcm                74726  3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_seq                52859  0
snd_seq_device          5597  1 snd_seq
snd_timer              17616  2 snd_pcm,snd_seq
evdev                   9894  6
joydev                  8923  0
snd                    51452  7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
i2c_bcm2708             4946  0
uname , fb info from /sys/... and fbset -i (framebuffer info)

Code: Select all

[email protected] ~ $ uname -a
Linux raspberrypi 3.18.9-v7 #7 SMP PREEMPT Sun Jun 28 09:33:18 CST 2015 armv7l GNU/Linux
[email protected]:/sys/bus/platform/devices# ls
alarmtimer         bcm2708_powerman.0  bcm2835_AUD3.3     ili9341.0            snd-hifiberry-dac.0
bcm2708_dma.0      bcm2708_spi.0       bcm2835_AUD4.4     leds-gpio            snd-hifiberry-digi.0
bcm2708-dmaengine  bcm2708_usb         bcm2835_AUD5.5     mmc-bcm2835.0        snd-rpi-dac.0
bcm2708_fb         bcm2708_vcio        bcm2835_AUD6.6     pcm1794a-codec       snd-rpi-hifiberry-dacplus.0
bcm2708_gpio       bcm2835_AUD0.0      bcm2835_AUD7.7     pcm5102a-codec       snd-rpi-iqaudio-dac.0
bcm2708_i2c.1      bcm2835_AUD1.1      bcm2835_hwmon.0    serial8250.0         snd-soc-dummy
bcm2708-i2s.0      bcm2835_AUD2.2      bcm2835_thermal.0  snd-hifiberry-amp.0  w1-gpio
[email protected]:/sys/bus/platform/devices# cd ili9341.0
[email protected]:/sys/bus/platform/devices/ili9341.0# ls
driver  driver_override  graphics  modalias  power  subsystem  uevent
[email protected]:/sys/bus/platform/devices/ili9341.0# cd graphics
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics# ls
fb0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics# cd fb0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# ls -la
total 0
drwxr-xr-x 3 root root    0 Oct 29 17:49 .
drwxr-xr-x 3 root root    0 Oct 29 17:49 ..
-rw-r--r-- 1 root root 4096 Oct 29 17:49 bits_per_pixel
-rw-r--r-- 1 root root 4096 Oct 29 17:49 blank
-rw-r--r-- 1 root root 4096 Oct 29 17:49 console
-rw-r--r-- 1 root root 4096 Oct 29 17:49 cursor
-r--r--r-- 1 root root 4096 Oct 29 17:49 dev
lrwxrwxrwx 1 root root    0 Oct 29 17:49 device -> ../../../ili9341.0
-rw-r--r-- 1 root root 4096 Oct 29 17:49 mode
-rw-r--r-- 1 root root 4096 Oct 29 17:49 modes
-r--r--r-- 1 root root 4096 Oct 29 17:49 name
-rw-r--r-- 1 root root 4096 Oct 29 17:49 pan
drwxr-xr-x 2 root root    0 Oct 29 17:49 power
-rw-r--r-- 1 root root 4096 Oct 29 17:49 rotate
-rw-r--r-- 1 root root 4096 Oct 29 17:49 state
-r--r--r-- 1 root root 4096 Oct 29 17:49 stride
lrwxrwxrwx 1 root root    0 Oct 29 17:49 subsystem -> ../../../../../class/graphics
-rw-r--r-- 1 root root 4096 Oct 29 17:49 uevent
-rw-r--r-- 1 root root 4096 Oct 29 17:49 virtual_size
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat name
ILI9325
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat bits_per_pixel
16
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat modes
U:480x320p-0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat virtual_size
480,320
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat dev
29:0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat rotate
0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat state
0
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# cat stride
960
[email protected]:/sys/bus/platform/devices/ili9341.0/graphics/fb0# fbset -i -fb /dev/fb0
 
mode "480x320"
    geometry 480 320 480 320 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/0
endmode
 
Frame buffer device information:
    Name        : ILI9325
    Address     : 0xbb80d000
    Size        : 307200
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 960
    Accelerator : No
What I know :D
- Controller is not ILI9341/ILI9325 - those are for smaller displays (320x240, etc...), I guess this might be ILI9486/9488 because they are for 480x320 displays. But when I compared init with DS it does not fit right so LCD can have a clone of ILI9486/9488 ...
- Module use only SPI interface and two CE signals (CE0 for touch controller, CE1 for LCD shift registers - compared to others lcd modules, in KeDei module this is swapped),
- all LCD control signals are on first shift registers,
- LCD works in 16bit mode - why, because two tracks have jumpers (R4 & R5 - not soldered) and are right beside other data signals,
- Touch controller is XPT2046 (or clone :) on SPI with CE0)

Files
I have upload on gdrive files from seller (sysimage and driver files, and also path file + ili9341.c from page heikki.virekunnas.fi )
- sysimage (for RPi B,B+ & RPi2) https://drive.google.com/file/d/0BySjzB ... sp=sharing
- driver files from seller https://drive.google.com/file/d/0BySjzB ... sp=sharing
- Patch file: https://drive.google.com/file/d/0BySjzB ... sp=sharing
- ILI9341.c driver file: https://drive.google.com/file/d/0BySjzB ... sp=sharing

I suck when it comes to kernel, especially loading modules with config :( ... So please, help?


----- EDIT: 2016-06-06 -----
After few months of being lazy I have made a prototype circuit of fbtft spi interface and wired it up to kedei lcd v1.1. So I'm going to test it :) , but in meantime I have put a KeDei "backup" repository for kernels & sysimages (for debian/raspbian only) - so I write this now "I am not going ever use other distro so there will no other distro backup". I've uploaded files to MediaFire.

KeDei raspbian system images (the backup repo)
https://www.mediafire.com/folder/t709uv ... dei-sysimg

KeDei kernels (the backup repo)
https://www.mediafire.com/folder/sxsyoh ... ei-kernels (this is called by chinese sellers "driver" :? )
Ps. 0. I hope my LCD is still working and my fbtft spi interface is good...


----- EDIT: 2016-06-07 -----
I've tested my circuit and unfortunatly I've broken my lcd ealier when I've been testing fbtft-spi adapter in spider-circuit :(
More photos I've put on my github project page with this hack :) :
https://github.com/saper-2/rpi-spi-lcd35-kedei
This is exact link to results: https://github.com/saper-2/rpi-spi-lcd3 ... .1/results

Here is one photo :D :
Image

Ps. Sorry for my bad English....
Last edited by saper_2 on Tue Jun 07, 2016 8:57 pm, edited 2 times in total.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Wed Nov 04, 2015 10:43 pm

One step further, I have somewhat working lcd from python script , and c++ program. :)

https://www.youtube.com/watch?v=_pR_oAXKIs0

I dropped test programs on github: https://github.com/saper-2/rpi-spi-lcd35-kedei, but this is slow - few sec to fill black whole screen O_o. As far I found by googling, the speed limiter is a bcm2835_spi kernel module, accessing to him by /dev/spidev0.1 take a lot of time.

So now I looking on fbflex, but I wonder how I should perform lcd reset, not to mention controlling signals of lcd?

I know on first shift register there are control signals for LCD, I know only 6 states: 2 for prepare and store data, 2 similar for command and 2 for reset - U1 is the first shift register.
Known output states:

Code: Select all

Q 8 7 6 5 4 3 2 1 - HEX  - Action
  0 0 0 0 0 0 0 0 - 0x00 - Reset     
  0 0 0 0 0 0 0 1 - 0x01 - Release Reset     
  0 0 0 1 0 0 0 1 - 0x11 - Prepare command     
  0 0 0 1 1 0 1 1 - 0x1B - Store command
  0 0 0 1 1 0 0 1 - 0x15 - Prepare data
  0 0 0 1 1 1 1 1 - 0x1F - Store data
By those shift register values I suspect signals:
- Q1 (bit 0) - Reset
- Q2 - might be: CS or WR
- Q3 - could be: Data/Command select

I'm thinking of trying to write a fbtft driver for this lcd, but at this moment I have no idea where to start :| ...

I'm going to wreck my brain by this tomorrow or on weekend... I need a some time off :)

If somebody could give some hints where to start to create fbtft device driver I would be grateful :)

notro
Posts: 693
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 05, 2015 6:13 pm

It will be very difficult to make this display work with fbtft. This display has in effect a combined 16-bit databus and an 8-bit control bus rolled into one 24-bit serial bus. It is most likely based on the SpriteMods circuit: http://spritesmods.com/?art=spitft&page=2
fbtft isn't very modular so it will be a hack to get this working. Much better to just use the driver you already have.
The major drawback with this bus solution is that it cuts the bandwith by 30% jsut to save some gpios.

This is a circuit that can be used with fbtft: https://github.com/notro/fbtft/wiki/SPI ... ce-circuit

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 05, 2015 10:26 pm

Interestingly, I've just commented on the Github thread about the same device.

https://github.com/notro/fbtft/issues/215

I've seen some other buyers saying that they could initialize the LCD with FBTFT.
@notro is that really impossible?

Thanks in advance.

notro
Posts: 693
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Fri Nov 06, 2015 3:39 pm

Looking at ILI9341.c it's clear that it writes 8 bytes per 16-bit word, even worse than I thought. 1 dummy byte + 16-bit word + control byte, which is done twice to toggle WR I guess:

Code: Select all

static  void spi_transform(unsigned char *spi_buff)
{
  writel(0x00,lcd_spi_base+SPI_FIFO);
  writel((unsigned char)*(spi_buff),lcd_spi_base+SPI_FIFO);
  writel((unsigned char)*(spi_buff+1),lcd_spi_base+SPI_FIFO);
  writel((unsigned char)*(spi_buff+2),lcd_spi_base+SPI_FIFO);
}

static inline void  cmd(unsigned  short cmd)
{
  _cmd[0] = (unsigned char)(cmd>>8);
  _cmd[1] = (unsigned char)cmd;
  _cmd[2] = CMD_BE;
  spi_transform(_cmd);

  _cmd[2] = CMD_AF;
  spi_transform(_cmd);
}
This driver just has to be very slow.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Fri Nov 06, 2015 7:59 pm

Hi,

Thanks notro for looking at code.

I have dropped on YT demo of pre-compiled kernel: https://www.youtube.com/watch?v=nfmZwp4D9-Q
I got twice a small glitch in refreshing LCD, last line of LXTerminal window didn't get repainted, hitting enter on empty command line did the trick.

I know this lcd is not sooo fast (actually very slow :/ ) , but speed is not really a matter - for me :) . I would like to set LXDE for dual-monitor setup (main HDMI, additional 3,5" ) - If I would get a refresh rate more than 0.5fps - that would be nice.
I don't plan to display in this small screen anything dynamic (4k, 60fps movie for example ;) ) - I want to show some form with buttons for user (if form get repainted/updated in about 2sec then user won't get annoyed (too much at least :D)). To do this, I need a next framebuffer device (e.g.: /dev/fb1 ).
At first, I thought I could just control 3.5" lcd from software but redrawing whole screen is so f**** slow, so the slower lcd got repaint, the quicker I dropped this idea...


notro do you think is possible with this lcd to get at least 0.5fps? Or this is just a pipe dream?

MunhozThiago - Look like you got a patch for a little newer version, there is a backlight control now, but I wonder on which pin of shift register. And I'm interested to see what you have on backside of LCD printed (model), but I don't force you to pry off lcd from pcb (this must be done gently :) , and at the end is most "dangerous" because lcd bounces suddenly)

notro
Posts: 693
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sat Nov 07, 2015 8:58 pm

At first, I thought I could just control 3.5" lcd from software but redrawing whole screen is so f**** slow, so the slower lcd got repaint, the quicker I dropped this idea...
Looks like you're sending one byte per spidev transfer (4 transfers in one message), at least you can send all 4 bytes in one transfer. That should speed it up a bit.

Code: Select all

int spi_transmit(int *h, uint8_t *data, int len, uint32_t spi_speed, uint8_t spi_bits) {
  int r;
  struct spi_ioc_transfer tr;

  if (*h == 0) return -1; // device not opened

  memset(&tr, 0, sizeof(tr));
  tr.tx_buf = data;
  tr.len = len;
  tr.speed_hz = spi_speed;
  tr.bits_per_word = spi_bits;

  r = ioctl(*h, SPI_IOC_MESSAGE(1), &tr);

  return r;
}
Also try and send two 4 byte buffers as 2 transfers in one message. This way cmd() and w_data() can be done in one message.
If it doesn't work try setting delay_usecs.
If the circuit can handle that try sending the 2 buffers as a 8 byte buffer in one transfer.

spidev is the fastest for big buffers (can benefit from interrupts and dma).
The bcm2835 library will be faster for transfers that fit the fifo (uses hw registers directly): http://www.airspayce.com/mikem/bcm2835/

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 10:49 am

saper_2 - My LCD board is the same of yours. Same version and date. I didn't have time to open it yet. Although, there are two versions of seller's images. At first i've downloaded the 1.0 (wich works fine) and now there is the V-2.0 (wich don't) I saw now that the patch is from the newer version. So I'm on the same place of you. For me it is not mandatory to have both HDMI and LCD working and if I could get this working with FBTFT would be great.

notro Do you have any idea if we could get FB_ILI9341 to work in this LCD?

It seems that guy Heikki from the page got it working, but in old kernel version.

I wonder if this is the same device of ours and could make it work: http://futurice.com/blog/id-like-to-hav ... d-on-my-pi

ait
Posts: 123
Joined: Sun Oct 30, 2011 6:51 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 11:54 am

Hello MunhozThiago,
no, it is not the same Display.
Its a Waveshare Display.
The KeDei works only with the sellers image.
I have both, the Kedei and the waveshare.
The waveshare works with notros driver.

Ait

notro
Posts: 693
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 2:46 pm

Do you have any idea if we could get FB_ILI9341 to work in this LCD?
You would have to make a new driver and override .write_vmem and .write_register to match the display. But it will be slower than ili9341.c because that one writes directly to the hw registers. It is faster to do that for less than spi fifo size transfers.
Using fbtft and writing directly to hw registers requires quite a lot of knowledge if you want it to work on Linux version >4.1, because we are removing ATAGS support and will later remove the hw register defines.

If you don't have to use a graphics library to do the rendering, I suggest driving the display from userspace. Drawing one button doesn't take long, because you can set the area you want to update. So it's just a few bytes. But updating the whole screen every time is of course slow.

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 4:57 pm

ait
Well, I don't know how you get that idea from MunhozThiago message that KeDei and waveshare are that same... Maybe because he didn't created new issue at github fbtft, but posted diff file under Waveshare lcd Issue.

Anyway we know that LCD: KeDei != Waveshare :)

I have made some "acceleration" with using library bcm2835 - about 10 time faster :D:D (not without problems, I had to switch to C from C++, and link bcm2835 lib manually):

Code: Select all

[email protected] ~/lcd/spi $ sudo ./lcd-test-bcmc
bcm2835 library version: 10042 (0x0000273a)
bcm2835 library & SPI configured.
LCD init. Time:   442.529ms
Fill black. Time:  1064.430ms
Fill red. Time:  1034.387ms
Fill green. Time:  1031.899ms
Fill blue. Time:  1031.627ms
Fill white. Time:  1031.444ms
Fill black. Time:  1064.159ms

Total LCD test time:  9204.442ms
bcm2835 library closed.
And video with new driver: https://youtu.be/yhm2lYVQIQw

notro
You know how to discourage me well :), not to mention I have 0+NULL experience with kernel drivers/accessing hw from kernel...
I will see what, I can do from user software (or whatever this is called :) ).
Speed is not an issue for me at least, and I think this lcd could work even faster than being driven from my test program.
I won't hide, that It would be great if I could display a form than doing primitive drawings directly from code...

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 9:36 pm

saper_2 wrote:ait
...we know that LCD: KeDei != Waveshare :)
Thanks ait for your answer regarding the FBTFT. I was hoping I could use it anyway. Instead, I've compiled a new kernel using the ILI9341.C and instructions by Heikki.

Everything works (at least seems to work...) even touchscreen. When connected to HDMI I can even see the pointer moving in my big screen. The only problem I have now is that it seems either Ubuntu Mate has something writing or blocking my /dev/fb1 or I've missed some configuration.

I'm downloading a raspbian image to try my kernel and check if I can solve this problem. Maybe saper_2 could benefit from it also! When everything is working I'll try the FBCP to mirror the buffer on both devices.

If anyone could help me posting a sequence of configuration files to change I would be very glad.

Let's hope it works! :D

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 08, 2015 10:15 pm

MunhozThiago
Are you trying to say, that you have both: HDMI and KeDei LCD running simultaneously?

About cursor:
a. can you move it from one screen to another, or
b. just it show up on both and move on both at the same time ?

Can you give more details about:
1. kernel version which you used as base?
2. which ili9341.c driver (from heikki or from the diff file from [email protected])?
3. ls /dev/ ? :)

Yes, I'm very interested :D , if you share some info then I will try play with some configs (& kernel build)


You could try to use fbi to test framebuffers or omxplayer or glxgears:

Code: Select all

 glxgears -fullscreen -display :0.0
Change 0.0 to 0.1 to get nex display...

There is some info about two display config: https://russ.garrett.co.uk/2013/04/15/d ... -in-linux/

ps. I updated my repo but nothing much, some minor changes....

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Mon Nov 09, 2015 10:36 am

saper_2

Sorry for my exciting last message. I must tell you that I think everything works, although I can't start x on my LCD yet.

What I do have right now:
  • 1 - Custom compiled kernel with Heikki's diff and ili9341.c (kernel version 4.1.12-v7+)
    2 - Kernel is configured to ILI9341 automatically
    2 - Ubuntu Mate
    3 - LCD and HDMI connected
    4 - LSMOD show FB_ili9341 and FBTFT loaded
    ILI9341 seems to be built-in loaded (saw this message somewhere, can't tell you exaclty)
    5 - DMESG shows nothing interesting
    6 - LS /DEV/ show two framebuffers: FB0 and FB1
7 - Added these lines to respective files:

Code: Select all

 ---------------------------------------------    
                         sudo nano /boot/cmdline.txt;
                         fbcon=map:1 fbcon=font:ProFont6x11;
                         ---------------------------------------------  
                         sudo nano /etc/modules;
                         ili9341
                         fb_ili9341
                         ---------------------------------------------
                         sudo nano /boot/config.txt
                         dtoverlay=ads7846,speed=500000,penirq=17,swapxy=1
                         ---------------------------------------------  
RESULTS:
  • 1 - Raspberry booting turns LCD on
    2 - Raspberries and console show on LCD
    3 - Ubuntu Mate splash screen appear
    4 - Something happens and
    if there is HDMI: X start on HDMI
    if there is no HDMI X never show
    5 - LCD turns white
    6 - Touchscreen on LCD works and pointer moves on HDMI
I've recorded the videos below so you can see and help me figure out what is happening:

1 - BOOT: https://youtu.be/1g4ffgse-iM
2 - TOUCH: https://youtu.be/gbjrhOrlRYM

Answering your questions:
a) cursor seems to work as input for both (can't tell if there is something on LCD)
b) that diff from KeDei does not work, there are errors on the file ( :o )
c) glxgears doesn't work on LCD, only shows on HDMI

Next Steps:
Play witth configs and try to start x on the LCD

Update: Results on Raspbian seems identical: https://youtu.be/wng4lzOLCy8

Update 2: Learning about FBCON, it seems that what I am missing is the binding from FBCON (which is working) to FB0 or FB1. Any Ideas?

Update 3: Using a tool called fbgrab I was able to retrieve a printscreen from my two framebuffers :D Now it seems that I'm really getting a mirrorer screen in both framebuffers. I still see a blank screen on my LCD. What this is supposed to mean?

FB0:http://goo.gl/dCg9mV

FB1:http://goo.gl/gs4LjW

Update 4: After a long discussion with my colleagues we believe that there is some misconfiguration on the kernel causing the buffers not to load. I'm trying to re-compile it.

Danii1005
Posts: 2
Joined: Wed Nov 11, 2015 6:42 am

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Wed Nov 11, 2015 6:45 am

Hello,

I have a KeDei v2.0 Display. The driver from the seller works pretty well, but i have a problem using the other GPIO Pins. When I try to use a Pin in a python program, lets say to get Temperature and Humidity from a DHT11 it says, that I must be root to have access to the GPIO Pins. This happens even if I execute it as root/sudo. I think they are locked by the Driver or something. The samehappens if I use the complete raspian image provided by the Seller.
Please help me :(

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Wed Nov 11, 2015 11:04 am

Danii1005 wrote:Hello,

The driver from the seller works pretty well
In fact the drivers from the seller are a custom compiled version of the kernel. It is probably using at least the GPIO pins used by the LCD (even though there is no LCD attached) and that's why you can't use the pins for other purposes while using this kernel version.

Danii1005
Posts: 2
Joined: Wed Nov 11, 2015 6:42 am

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Wed Nov 11, 2015 1:58 pm

Thanks for the fast reply.

I want to use another GPIO Pin (4 or 5 for example)

This is a Port that is not used by the LCD. Is there any chance to get this working?

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Tue Nov 17, 2015 9:26 pm

Danii1005 wrote:I want to use another GPIO Pin (4 or 5 for example)
This is a Port that is not used by the LCD. Is there any chance to get this working?
There is loaded quiet a bit of modules as far I remember. Might be some modules are using those pins, also check if you referring to WiringPi GPIO layout and BCM GPIO layout. :)

notro - If I would hack this circuit to work as the one on fbtft repo (remove U1, add 74HC4040 + inverter, wire signals to: GPIO (presumed: D/C and RST), inverter (presumed WR), CE1 (presumed CS) ) then this LCD can work with fbtft? schema here: https://github.com/saper-2/rpi-spi-lcd3 ... er/hw-hack
As I earlier written, I don't expect high fps on this lcd, few-to-15fps would be fine :) ,


Ps. I'm back :D to this lcd. I got in meantime a 5inch hdmi 800x480px with usb touch (custom controller - driver - classic I would say, compiled kernel only...) and I have been working on making the touch to work :) - I have uploaded to github my results and user-space driver (py script :D)

MunhozThiago
Posts: 7
Joined: Sun Oct 25, 2015 6:27 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Tue Nov 17, 2015 10:36 pm

saper_2 Welcome back! Did you see my step-by-step post?

amzg
Posts: 6
Joined: Thu Nov 19, 2015 4:12 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 19, 2015 7:39 pm

Hello! :D

A few week ago, I bought a screen in Aliexpress, I thought I was buying a Waveshare, but no, when I reached it I found a Kedei display :o

I wanted the screen to use it with Retropie, to put the raspberry pi into a classic gameboy.

I see that it's impractical to use Kedei TFT for this project because it's very slow.

But anyone know why I can't get Retropie on the TFT display??? (I use the manufacturer's drivers, version 2.0.)
https://youtu.be/NwueJk0m7PM

And the last question, do you think that in the future this TFT will be faster? or maybe the soultion is buying a tft screen car (rca)??

thanx

BOiO
Posts: 3
Joined: Sun Nov 15, 2015 9:42 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 19, 2015 8:13 pm

excuse me for the intrusion, but is the only post that i found on the internets about this touch screen lcd.

i have a really big problem to use this on my rpi model B ant the last version of retropie 3.2.1
after the fresh install of the system i install "LCD-show" driver supplied by the official store and this is what i see on the screen:

https://youtu.be/VcslfNJaJ7E

ps: i’ve also tried this method

sudo apt-get install cmake
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp

fbcp &

#run emulation station:
emulationstation

ps: installing raspbian it works fine (without the touch, but i don't care). i have only this problem running
could you please give me a hand?

thank you

User avatar
saper_2
Posts: 232
Joined: Sun Aug 03, 2014 10:08 am
Location: PL

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 19, 2015 9:50 pm

MunhozThiago wrote:saper_2 Welcome back! Did you see my step-by-step post?
Yes, you're stuck at kernel compiling (still ;P ) .
And, for black lcd screen, I get that you have have on hdmi desktop visible.... I suppose you've already looked at multi-monitor configurations wirth rpi (with those usb->dvi/vga adapters)

BOiO, check config of retropi - I don't know it so can't tell where for what to look, but this might be something with display setup on xserver (if it use one), if this use pygame then there must be somewhere config that set output screen to fb0 (which I assume is the HDMI), not fb1 (the LCD).
Where you have the drivers/kernel image/ etc files for your screen (link(s) from seller?? We would like to take a look on them. And link to where you bought your display would be nice :)
Can you post result of those commands:

Code: Select all

lsmod
ls -la /boot/
ls -la /boot/overlays
cat /boot/config.txt
cat /boot/cmdline.txt

bootlog would be nice too :) (

Code: Select all

[email protected] ~ $ cat /var/log/kern.log > log.txt
) you can paste in to pastebin.com :)


Hey, did you see that?! This is what we try to do.... Might be that the manufacturer fixed driver? Or we config something wrongly?

Ps. I just replaced hdd in my main laptop (old was too small already) so it will take me some time to "return to normal operation" :D (installing soft, moving files, configuring apps...).

amzg
Posts: 6
Joined: Thu Nov 19, 2015 4:12 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Thu Nov 19, 2015 11:12 pm

Hello, I have the same problem than BOiO.

KeDei 2.0 drivers with retropie.
saper_2 wrote:Where you have the drivers/kernel image/ etc files for your screen (link(s) from seller?? We would like to take a look on them.
To load drivers from seller:
sudo cp ./lcd_35_v2/kernel.img /boot/kernel.img
sudo cp ./lcd_35_v2/kernel7.img /boot/
sudo cp -rf ./lcd_35_v2/lib/* /lib/
sudo reboot
saper_2 wrote:And link to where you bought your display would be nice :)
http://es.aliexpress.com/item/Best-Pric ... ber=910129


[email protected] ~ $ lsmod
Module Size Used by
binfmt_misc 6310 1
snd_bcm2835 18739 1
uinput 6890 0
snd_soc_bcm2708_i2s 6448 0
regmap_mmio 2961 1 snd_soc_bcm2708_i2s
snd_soc_core 139781 1 snd_soc_bcm2708_i2s
snd_compress 7579 1 snd_soc_core
snd_pcm_dmaengine 3335 1 snd_soc_core
snd_pcm 74726 4 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_seq 52859 0
snd_seq_device 5597 1 snd_seq
snd_timer 17616 2 snd_pcm,snd_seq
evdev 9894 3
joydev 8923 0
snd 51452 8 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress

[email protected] ~ $ ls -la /boot/
total 24118
drwxr-xr-x 4 root root 16384 Jan 1 1970 .
drwxr-xr-x 22 root root 4096 Nov 19 19:28 ..
-rwxr-xr-x 1 root root 9846 Sep 23 15:10 bcm2708-rpi-b.dtb
-rwxr-xr-x 1 root root 10125 Sep 23 15:10 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x 1 root root 9850 Sep 23 15:10 bcm2708-rpi-cm.dtb
-rwxr-xr-x 1 root root 11113 Sep 23 15:10 bcm2709-rpi-2-b.dtb
-rwxr-xr-x 1 root root 17900 Sep 23 15:10 bootcode.bin
-rwxr-xr-x 1 root root 142 Jan 7 2014 cmdline.txt
-rwxr-xr-x 1 root root 1175 Oct 28 02:10 config.txt
-rwxr-xr-x 1 root root 18693 Aug 21 16:04 COPYING.linux
-rwxr-xr-x 1 root root 41 Jan 15 2015 .firmware_revision
-rwxr-xr-x 1 root root 2392 Sep 23 15:10 fixup_cd.dat
-rwxr-xr-x 1 root root 6359 Sep 23 15:10 fixup.dat
-rwxr-xr-x 1 root root 9599 Sep 23 15:10 fixup_db.dat
-rwxr-xr-x 1 root root 9597 Sep 23 15:10 fixup_x.dat
-rwxr-xr-x 1 root root 137 Jan 7 2014 issue.txt
-rwxr-xr-x 1 root root 8513524 Nov 19 19:32 kernel7.img
-rwxr-xr-x 1 root root 4018816 Nov 19 19:32 kernel.img
-rwxr-xr-x 1 root root 1447 Aug 21 16:04 LICENCE.broadcom
-rwxr-xr-x 1 root root 18974 Sep 25 2013 LICENSE.oracle
drwxr-xr-x 2 root root 6144 Oct 3 17:31 overlays
-rwxr-xr-x 1 root root 596824 Sep 23 15:10 start_cd.elf
-rwxr-xr-x 1 root root 4852968 Sep 23 15:10 start_db.elf
-rwxr-xr-x 1 root root 2719896 Sep 23 15:10 start.elf
-rwxr-xr-x 1 root root 3810376 Sep 23 15:10 start_x.elf
drwxr-xr-x 2 root root 2048 Jun 23 2014 .Trashes
-rwxr-xr-x 1 root root 4096 Jun 23 2014 ._.Trashes

[email protected] ~ $ ls -la /boot/overlays
total 154
drwxr-xr-x 2 root root 6144 Oct 3 17:31 .
drwxr-xr-x 4 root root 16384 Jan 1 1970 ..
-rwxr-xr-x 1 root root 2394 Aug 21 16:04 ads7846-overlay.dtb
-rwxr-xr-x 1 root root 449 Sep 23 15:06 bmp085_i2c-sensor-overlay.dtb
-rwxr-xr-x 1 root root 1019 Sep 23 15:04 dht11-overlay.dtb
-rwxr-xr-x 1 root root 1367 Aug 21 16:04 enc28j60-overlay.dtb
-rwxr-xr-x 1 root root 977 Sep 23 15:05 gpio-poweroff-overlay.dtb
-rwxr-xr-x 1 root root 779 Aug 21 16:04 hifiberry-amp-overlay.dtb
-rwxr-xr-x 1 root root 655 Aug 21 16:04 hifiberry-dac-overlay.dtb
-rwxr-xr-x 1 root root 783 Aug 21 16:04 hifiberry-dacplus-overlay.dtb
-rwxr-xr-x 1 root root 783 Aug 21 16:04 hifiberry-digi-overlay.dtb
-rwxr-xr-x 1 root root 2428 Aug 21 16:04 hy28a-overlay.dtb
-rwxr-xr-x 1 root root 2899 Aug 21 16:04 hy28b-overlay.dtb
-rwxr-xr-x 1 root root 1751 Sep 23 15:06 i2c-rtc-overlay.dtb
-rwxr-xr-x 1 root root 263 Sep 23 15:04 i2s-mmap-overlay.dtb
-rwxr-xr-x 1 root root 775 Aug 21 16:04 iqaudio-dac-overlay.dtb
-rwxr-xr-x 1 root root 775 Aug 21 16:04 iqaudio-dacplus-overlay.dtb
-rwxr-xr-x 1 root root 1428 Aug 21 16:04 lirc-rpi-overlay.dtb
-rwxr-xr-x 1 root root 1865 Aug 21 16:04 mcp2515-can0-overlay.dtb
-rwxr-xr-x 1 root root 1865 Sep 23 15:05 mcp2515-can1-overlay.dtb
-rwxr-xr-x 1 root root 439 Sep 23 15:03 mmc-overlay.dtb
-rwxr-xr-x 1 root root 2754 Sep 23 15:10 mz61581-overlay.dtb
-rwxr-xr-x 1 root root 2609 Aug 21 16:04 piscreen-overlay.dtb
-rwxr-xr-x 1 root root 2658 Aug 21 16:04 pitft28-resistive-overlay.dtb
-rwxr-xr-x 1 root root 1003 Aug 21 16:04 pps-gpio-overlay.dtb
-rwxr-xr-x 1 root root 1006 Sep 23 15:06 pwm-2chan-overlay.dtb
-rwxr-xr-x 1 root root 883 Sep 23 15:06 pwm-overlay.dtb
-rwxr-xr-x 1 root root 987 Sep 23 15:10 raspidac3-overlay.dtb
-rwxr-xr-x 1 root root 22958 Sep 23 15:10 README
-rwxr-xr-x 1 root root 643 Aug 21 16:04 rpi-dac-overlay.dtb
-rwxr-xr-x 1 root root 2365 Aug 21 16:04 rpi-display-overlay.dtb
-rwxr-xr-x 1 root root 484 Sep 23 15:06 rpi-ft5406-overlay.dtb
-rwxr-xr-x 1 root root 771 Aug 21 16:04 rpi-proto-overlay.dtb
-rwxr-xr-x 1 root root 893 Sep 23 15:05 rpi-sense-overlay.dtb
-rwxr-xr-x 1 root root 1812 Sep 23 15:05 sdhost-overlay.dtb
-rwxr-xr-x 1 root root 2342 Sep 23 15:10 sdio-overlay.dtb
-rwxr-xr-x 1 root root 376 Sep 23 15:10 smi-dev-overlay.dtb
-rwxr-xr-x 1 root root 1544 Sep 23 15:10 smi-nand-overlay.dtb
-rwxr-xr-x 1 root root 1001 Sep 23 15:10 smi-overlay.dtb
-rwxr-xr-x 1 root root 330 Sep 23 15:04 spi-bcm2708-overlay.dtb
-rwxr-xr-x 1 root root 330 Aug 21 16:04 spi-bcm2835-overlay.dtb
-rwxr-xr-x 1 root root 473 Sep 23 15:06 spi-dma-overlay.dtb
-rwxr-xr-x 1 root root 5042 Aug 21 16:04 tinylcd35-overlay.dtb
-rwxr-xr-x 1 root root 996 Sep 23 15:05 uart1-overlay.dtb
-rwxr-xr-x 1 root root 778 Sep 23 15:05 vga666-overlay.dtb
-rwxr-xr-x 1 root root 1124 Aug 21 16:04 w1-gpio-overlay.dtb
-rwxr-xr-x 1 root root 1291 Aug 21 16:04 w1-gpio-pullup-overlay.dtb

[email protected] ~ $ cat /boot/config.txt
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

# for more options see http://elinux.org/RPi_config.txt
gpu_mem_256=128
gpu_mem_512=256
gpu_mem_1024=256

overscan_scale=1

[email protected] ~ $ cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

[email protected] ~ $ nano log.txt
GNU nano 2.2.6 File: log.txt

Jul 20 17:07:45 retropie kernel: imklog 5.8.11, log source = /proc/kmsg started.
Jul 20 17:07:45 retropie kernel: [ 0.000000] Booting Linux on physical CPU 0xf00
Jul 20 17:07:45 retropie kernel: [ 0.000000] Initializing cgroup subsys cpuset
Jul 20 17:07:45 retropie kernel: [ 0.000000] Initializing cgroup subsys cpu
Jul 20 17:07:45 retropie kernel: [ 0.000000] Initializing cgroup subsys cpuacct
Jul 20 17:07:45 retropie kernel: [ 0.000000] Linux version 4.1.7-v7+ ([email protected]) (gcc version 4.$
Jul 20 17:07:45 retropie kernel: [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53$
Jul 20 17:07:45 retropie kernel: [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instr$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1
Jul 20 17:07:45 retropie kernel: [ 0.000000] cma: Reserved 8 MiB at 0x2e800000
Jul 20 17:07:45 retropie kernel: [ 0.000000] Memory policy: Data cache writealloc
Jul 20 17:07:45 retropie kernel: [ 0.000000] On node 0 totalpages: 192512
Jul 20 17:07:45 retropie kernel: [ 0.000000] free_area_init_node: node 0, pgdat 8085af80, node_mem_map ae$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Normal zone: 1692 pages used for memmap
Jul 20 17:07:45 retropie kernel: [ 0.000000] Normal zone: 0 pages reserved
Jul 20 17:07:45 retropie kernel: [ 0.000000] Normal zone: 192512 pages, LIFO batch:31
Jul 20 17:07:45 retropie kernel: [ 0.000000] [bcm2709_smp_init_cpus] enter (9420->f3003010)
Jul 20 17:07:45 retropie kernel: [ 0.000000] [bcm2709_smp_init_cpus] ncores=4
Jul 20 17:07:45 retropie kernel: [ 0.000000] PERCPU: Embedded 13 pages/cpu @ae114000 s20608 r8192 d24448 $
Jul 20 17:07:45 retropie kernel: [ 0.000000] pcpu-alloc: s20608 r8192 d24448 u53248 alloc=13*4096
Jul 20 17:07:45 retropie kernel: [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
Jul 20 17:07:45 retropie kernel: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Tota$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=$
Jul 20 17:07:45 retropie kernel: [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
Jul 20 17:07:45 retropie kernel: [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 by$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 byte$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Memory: 744632K/770048K available (5958K kernel code, 534K r$
Jul 20 17:07:45 retropie kernel: [ 0.000000] Virtual kernel memory layout:
Jul 20 17:07:45 retropie kernel: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] vmalloc : 0xaf800000 - 0xff000000 (1272 MB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] lowmem : 0x80000000 - 0xaf000000 ( 752 MB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] modules : 0x7f000000 - 0x80000000 ( 16 MB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] .text : 0x80008000 - 0x80775cd0 (7608 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] .init : 0x80776000 - 0x807de000 ( 416 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] .data : 0x807de000 - 0x80863af4 ( 535 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] .bss : 0x80866000 - 0x8092378c ( 758 kB)
Jul 20 17:07:45 retropie kernel: [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Jul 20 17:07:45 retropie kernel: [ 0.000000] Preemptible hierarchical RCU implementation.
Jul 20 17:07:45 retropie kernel: [ 0.000000] Additional per-CPU info printed with stalls.
Jul 20 17:07:45 retropie kernel: [ 0.000000] NR_IRQS:608
Jul 20 17:07:45 retropie kernel: [ 0.000000] Architected cp15 timer(s) running at 19.20MHz (virt).
Jul 20 17:07:45 retropie kernel: [ 0.000000] clocksource arch_sys_counter: mask: 0xffffffffffffff max_cyc$
Jul 20 17:07:45 retropie kernel: [ 0.000010] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every $
Jul 20 17:07:45 retropie kernel: [ 0.000034] Switching to timer-based delay loop, resolution 52ns
Jul 20 17:07:45 retropie kernel: [ 0.000326] Console: colour dummy device 80x30
Jul 20 17:07:45 retropie kernel: [ 0.002093] console [tty1] enabled

BOiO
Posts: 3
Joined: Sun Nov 15, 2015 9:42 pm

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Fri Nov 20, 2015 7:48 pm

saper_2 wrote:
MunhozThiago wrote:saper_2 Welcome back! Did you see my step-by-step post?
Yes, you're stuck at kernel compiling (still ;P ) .
And, for black lcd screen, I get that you have have on hdmi desktop visible.... I suppose you've already looked at multi-monitor configurations wirth rpi (with those usb->dvi/vga adapters)

BOiO, check config of retropi - I don't know it so can't tell where for what to look, but this might be something with display setup on xserver (if it use one), if this use pygame then there must be somewhere config that set output screen to fb0 (which I assume is the HDMI), not fb1 (the LCD).
Where you have the drivers/kernel image/ etc files for your screen (link(s) from seller?? We would like to take a look on them. And link to where you bought your display would be nice :)
Can you post result of those commands:

Code: Select all

lsmod
ls -la /boot/
ls -la /boot/overlays
cat /boot/config.txt
cat /boot/cmdline.txt

bootlog would be nice too :) (

Code: Select all

[email protected] ~ $ cat /var/log/kern.log > log.txt
) you can paste in to pastebin.com :)


Hey, did you see that?! This is what we try to do.... Might be that the manufacturer fixed driver? Or we config something wrongly?

Ps. I just replaced hdd in my main laptop (old was too small already) so it will take me some time to "return to normal operation" :D (installing soft, moving files, configuring apps...).

thanks for the fast reply!
here's my configuration

lsmod: http://pastebin.com/uW35hYZs
ls -la /boot/ : http://pastebin.com/QewfzArK
ls -la /boot/overlays : http://pastebin.com/wmrGYxZB
cat /boot/config.txt : http://pastebin.com/mhEff9AV
cat /boot/cmdline.txt : http://pastebin.com/Zs0P4ukL

bootlog: http://pastebin.com/Ee2iwa0u

i have bought this lcd from http://www.aliexpress.com/item/Brand-ne ... 71795.html.
unfortunately, drivers are not supplied by the seller.
i've found them on the official store http://world.taobao.com/item/5201693264 ... 6.2.8OGUfj and followed the install instructions.

Viiloribo
Posts: 2
Joined: Sun Nov 22, 2015 11:15 am

Re: KeDei 3.5 inch 480x320 TFT lcd from ali

Sun Nov 22, 2015 8:07 pm

Hello saper_2!
Thank you for your work,
and I would like to know what's up with your hack-mod device ? as increased speed? and if not difficult to make a video with the work FBTFT? I just want to repeat your feat of hack-mod !!

thank.

Return to “Interfacing (DSI, CSI, I2C, etc.)”