页次: 1
只要是linux framebuffer驱动的屏幕,都是一样的驱动。
大佬,能详细一点吗,我使用的spi屏幕就是设备fb0,如果我想自己写一个驱动来显示一些东西,该怎么做呢
请教一下,已经使用spi驱动的屏幕,需要怎么操作,可以让自己写的驱动使用该屏幕
shuiyihang 说:出现了新转机,现在的情况是,屏幕较暗
但是可以看到左上角有一个横行光标类似于这种_
在一闪一闪,但仍然没有串口信息那驱动没有问题了, 上面有串口信息需要修改u-boot的bootargs参数里面的tty=/dev/fb1???
不知道有没有记错, 你试一试。
谢谢大佬,我把console=fb0重新改为tty0就ok了
shuiyihang 说:提示:cat: write error: No space left on device
什么情况呢?屏幕有反应吗?有没有雪花飘飘
晕哥,我屏幕按照你的命令有雪花了,但是还是没有串口信息,该怎么做呢
shuiyihang 说:出现了新转机,现在的情况是,屏幕较暗
但是可以看到左上角有一个横行光标类似于这种_
在一闪一闪,但仍然没有串口信息那驱动没有问题了, 上面有串口信息需要修改u-boot的bootargs参数里面的tty=/dev/fb1???
不知道有没有记错, 你试一试。
你好,我重新执行了晕哥给的那个命令cat /dev/urandom > /dev/fb0
屏幕花屏
另外就是,那个fb1应该是大lcd的,我刚才把他的树节点注释后已经没了,确定我这块小屏就是fb0
出现了新转机,现在的情况是,屏幕较暗
但是可以看到左上角有一个横行光标类似于这种_
在一闪一闪,但仍然没有串口信息
shuiyihang 说:刚才测试了,使用gpio模拟驱动,可以正常显示要求的内容,也就是硬件啥的没问题,
那就尴尬了,不知道咋办啊 啊啊啊啊是f1c100s的gpio吗?
是的,刚才我又做了点事情,上面的测试用的是本站一个大佬提供的linux内核版本是5.2,编译完之后只产生了一个fb0
就在刚刚我重新编译了我自己从GitHub上下的licheepi的分支,内核版本是4.15
发现,屏幕被点亮后,迅速从上到下,被熄灭,然后/dev下有两个fb,一个fb0,一个fb1
这时所有信息:
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano (shuiyihang@linux) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #3 Thu Sep 24 16:58:41 CST 2020
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] random: fast init done
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=fb0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 55172K/65536K available (6144K kernel code, 237K rwdata, 1392K rodata, 1024K init, 244K bss, 10364K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc4800000 - 0xff800000 ( 944 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 238 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 245 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000045] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000107] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000624] Console: colour dummy device 80x30
[ 0.000714] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070224] pid_max: default: 32768 minimum: 301
[ 0.070527] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070568] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.071955] CPU: Testing write buffer coherency: ok
[ 0.073548] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076037] devtmpfs: initialized
[ 0.082237] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.082299] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.082545] pinctrl core: initialized pinctrl subsystem
[ 0.084464] NET: Registered protocol family 16
[ 0.085807] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.087524] cpuidle: using governor menu
[ 0.112175] SCSI subsystem initialized
[ 0.112497] usbcore: registered new interface driver usbfs
[ 0.112639] usbcore: registered new interface driver hub
[ 0.112849] usbcore: registered new device driver usb
[ 0.113259] pps_core: LinuxPPS API ver. 1 registered
[ 0.113283] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.113340] PTP clock support registered
[ 0.113782] Advanced Linux Sound Architecture Driver Initialized.
[ 0.115258] clocksource: Switched to clocksource timer
[ 0.140500] NET: Registered protocol family 2
[ 0.141867] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.141946] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.141995] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.142259] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.142311] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.142760] NET: Registered protocol family 1
[ 0.143935] RPC: Registered named UNIX socket transport module.
[ 0.143975] RPC: Registered udp transport module.
[ 0.143994] RPC: Registered tcp transport module.
[ 0.144011] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.146226] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.147947] Initialise system trusted keyrings
[ 0.148479] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.165466] NFS: Registering the id_resolver key type
[ 0.165548] Key type id_resolver registered
[ 0.165568] Key type id_legacy registered
[ 0.178599] Key type asymmetric registered
[ 0.178637] Asymmetric key parser 'x509' registered
[ 0.178833] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.178866] io scheduler noop registered
[ 0.178884] io scheduler deadline registered
[ 0.179599] io scheduler cfq registered (default)
[ 0.179632] io scheduler mq-deadline registered
[ 0.179651] io scheduler kyber registered
[ 0.180714] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.190115] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.353050] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.359587] console [ttyS0] disabled
[ 0.379828] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[ 0.847393] console [ttyS0] enabled
[ 0.857784] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.867094] SCSI Media Changer driver v0.25
[ 0.874679] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.881341] ehci-platform: EHCI generic platform driver
[ 0.886901] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.893121] ohci-platform: OHCI generic platform driver
[ 0.898817] usbcore: registered new interface driver usb-storage
[ 0.905857] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 0.914768] i2c /dev entries driver
[ 0.975382] sunxi-mmc 1c0f000.mmc: base:0x5e0c92b4 irq:19
[ 0.982724] usbcore: registered new interface driver usbhid
[ 0.988421] usbhid: USB HID core driver
[ 0.992475] fbtft_of_value: buswidth = 8
[ 0.996506] fbtft_of_value: debug = 0
[ 1.000169] fbtft_of_value: rotate = 0
[ 1.003913] fbtft_of_value: fps = 33
[ 1.052960] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.063419] mmc0: new high speed SDHC card at address 1234
[ 1.069992] mmcblk0: mmc0:1234 SA16G 14.6 GiB
[ 1.077328] mmcblk0: p1 p2
[ 2.315799] random: crng init done
[ 5.770925] Console: switching to colour frame buffer device 30x40
[ 5.779363] graphics fb0: fb_st7789v frame buffer, 240x320, 150 KiB video memory, 4 KiB buffer memory, fps=33, spi0.0 at 32 MHz
[ 5.804722] NET: Registered protocol family 17
[ 5.809522] Key type dns_resolver registered
[ 5.824344] Loading compiled-in X.509 certificates
[ 5.843286] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739498)
[ 5.852171] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073877c)
[ 5.859957] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 5.866614] [drm] No driver support for vblank timestamp query.
[ 5.877778] sun4i-drm display-engine: fb1: frame buffer device
[ 5.887256] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 5.896365] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 5.908185] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 5.913977] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 5.949864] hub 1-0:1.0: USB hub found
[ 5.953793] hub 1-0:1.0: 1 port detected
[ 5.959352] using random self ethernet address
[ 5.963818] using random host ethernet address
[ 5.970008] usb0: HOST MAC 0e:c8:c1:af:10:aa
[ 5.974378] usb0: MAC 3e:b3:c0:4c:a6:69
[ 5.978441] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 5.985992] g_cdc gadget: g_cdc ready
[ 5.990445] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 6.008045] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 6.014786] ALSA device list:
[ 6.017862] #0: Loopback 1
[ 6.021547] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 6.030254] cfg80211: failed to load regulatory.db
[ 6.038315] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[ 10.537447] EXT4-fs (mmcblk0p2): recovery complete
[ 10.545953] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 10.554148] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 10.564630] devtmpfs: mounted
[ 10.572321] Freeing unused kernel memory: 1024K
[ 10.820274] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
Starting logging: OK
Initializing random number generator... done.
Hello sir~
linuxCard login: root
Password:
# cd /dev
# ls
adsp ptyv7 ttyd9
audio ptyv8 ttyda
bus ptyv9 ttydb
console ptyva ttydc
cpu_dma_latency ptyvb ttydd
dri ptyvc ttyde
dsp ptyvd ttydf
fb0 ptyve ttye0
fb1 ptyvf ttye1
.....
# cat /proc/version
Linux version 4.15.0-rc8-licheepi-nano (shuiyihang@linux) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #3 Thu Sep 24 16:58:41 CST 2020
刚才测试了,使用gpio模拟驱动,可以正常显示要求的内容,也就是硬件啥的没问题,
那就尴尬了,不知道咋办啊 啊啊啊啊
这个是原文: https://www.cnblogs.com/listenscience/p/13619930.html
我不行先试试使用单片机的方式,直接把那个程序移植为驱动,先看看能不能画一条线,看看是不是硬件啥的问题
别的也没啥方法了
shuiyihang 说:对,现在就是开机白屏,用了那个命令之后,就完全黑屏了,串口提示没有空间在设备上,驱动我就是使用的内核文件里的driver/stage里st7789的代码,除了改动了init_display里的代码,把里面的初始化代码改为stm32里初始化屏幕的操作数据,然后我这个屏幕单纯初始化完是花屏,所以昨天花了点时间,按照卖家说的,屏幕花屏是正常的,需要清屏一下,然后清屏完是白屏的状况
这个提示是正常的 cat: write error: No space left on device
可以不需要你初始化, 配置好驱动和dts就可以了, 一行代码都不要改。
换回原来的驱动屏幕都点不亮了=|
static int init_display(struct fbtft_par *par)
{
// int i,j;
// u16 clear=0xffff;
// u16 start=0;
// u16 end=239;
// par->fbtftops.reset(par);
// mdelay(100);
// write_reg(par,0x11);
// mdelay(100);
// write_reg(par,0x36,0x00);
// write_reg(par,0x3A,0x05);
// write_reg(par,0xB2,0x0C,0x0C,0x00,0x33,0x33);
// write_reg(par,0xB7,0x35);
// write_reg(par,0xBB,0x32);
// write_reg(par,0xC2,0x01);
// write_reg(par,0xC3,0x15);
// write_reg(par,0xC4,0x20);
// write_reg(par,0xC6,0x0F);
// write_reg(par,0xD0,0xA4,0xA1);
// write_reg(par,0xE0,0xD0,0x08,0x0E,0x09,0x09,0x05,0x31,0x33,0x48,0x17,0x14,0x15,0x31,0x34);
// write_reg(par,0xE1,0xD0,0x08,0x0E,0x09,0x09,0x15,0x31,0x33,0x48,0x17,0x14,0x15,0x31,0x34);
// write_reg(par,0x21);
// mdelay(50);
// //clear lcd
// write_reg(par,0x2a);
// fbtft_write_buf_dc(par,&start,sizeof(start),1);
// fbtft_write_buf_dc(par,&end,sizeof(end),1);
// write_reg(par,0x2b);
// fbtft_write_buf_dc(par,&start,sizeof(start),1);
// fbtft_write_buf_dc(par,&end,sizeof(end),1);
// write_reg(par,0x2c);
// for(i=0;i<240;i++)
// {
// for(j=0;j<240;j++)
// {
// fbtft_write_buf_dc(par,&clear,sizeof(clear),1);
// }
// }
// write_reg(par,0x29);
// mdelay(200);
// return 0;
//以下为原代码
/* turn off sleep mode */
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
mdelay(120);
/* set pixel format to RGB-565 */
write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);
/*
* VGH = 13.26V
* VGL = -10.43V
*/
write_reg(par, GCTRL, 0x35);
/*
* VDV and VRH register values come from command write
* (instead of NVM)
*/
write_reg(par, VDVVRHEN, 0x01, 0xFF);
/*
* VAP = 4.1V + (VCOM + VCOM offset + 0.5 * VDV)
* VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV)
*/
write_reg(par, VRHS, 0x0B);
/* VDV = 0V */
write_reg(par, VDVS, 0x20);
/* VCOM = 0.9V */
write_reg(par, VCOMS, 0x20);
/* VCOM offset = 0V */
write_reg(par, VCMOFSET, 0x20);
/*
* AVDD = 6.8V
* AVCL = -4.8V
* VDS = 2.3V
*/
write_reg(par, PWCTRL1, 0xA4, 0xA1);
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
return 0;
}
shuiyihang 说:对,现在就是开机白屏,用了那个命令之后,就完全黑屏了,串口提示没有空间在设备上,驱动我就是使用的内核文件里的driver/stage里st7789的代码,除了改动了init_display里的代码,把里面的初始化代码改为stm32里初始化屏幕的操作数据,然后我这个屏幕单纯初始化完是花屏,所以昨天花了点时间,按照卖家说的,屏幕花屏是正常的,需要清屏一下,然后清屏完是白屏的状况
这个提示是正常的 cat: write error: No space left on device
可以不需要你初始化, 配置好驱动和dts就可以了, 一行代码都不要改。
我按照本站的另外一个贴子下面的网址的步骤操作的,他已经成功在屏幕上显示信息,我先按照你说的试一下吧,不过觉得大概可能会屏幕无法点亮:p
shuiyihang 说:除了显示 cat: write error: No space left on device
屏幕也变黑了一点显示都没有?那不对啊,驱动还有问题?
对,现在就是开机白屏,用了那个命令之后,就完全黑屏了,串口提示没有空间在设备上,驱动我就是使用的内核文件里的driver/stage里st7789的代码,除了改动了init_display里的代码,把里面的初始化代码改为stm32里初始化屏幕的操作数据,然后我这个屏幕单纯初始化完是花屏,所以昨天花了点时间,按照卖家说的,屏幕花屏是正常的,需要清屏一下,然后清屏完是白屏的状况
除了显示 cat: write error: No space left on device
屏幕也变黑了
shuiyihang 说:是这样的大佬,屏幕初始化需要spi的一系列操作,最后才能白屏,这不是说明屏幕和时序是正常的,不然连白屏也做不到
试一试这个命令:
cat /dev/urandom > /dev/fb0
注意看你的设备是fb0,还是fb1 ...
然后看屏幕有没有反应
提示:cat: write error: No space left on device
什么情况呢?
白屏只能说明背光正常,时序可能有问题。
确认屏是不是好的,再次检查硬件联线。
是这样的大佬,屏幕初始化需要spi的一系列操作,最后才能白屏,这不是说明屏幕和时序是正常的,不然连白屏也做不到
逻辑分析仪看下时序,或者搜一下本站st7789帖子
我看网上他们使用的spi小屏的教程,按照他们的操作下来,差不多该有的都有了,可是人家操作了起来,我这里有问题。。。。。
你好,手头没有查看时序的工具,另外本站的相关帖子已经看过了,没解决,所以又发了一遍问题,现在的情况是,屏幕可以点亮,但是接下来就没反应了,纯小白,不知道怎么搞了,请大佬给看看
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: console=fb0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.931696] fbtft_of_value: buswidth = 8
[ 0.935628] fbtft_of_value: debug = 0
[ 0.939374] fbtft_of_value: rotate = 0
[ 0.943125] fbtft_of_value: fps = 33
[ 0.947895] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 0.994047] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.004593] mmc0: new high speed SDHC card at address 1234
[ 1.013213] mmcblk0: mmc0:1234 SA16G 14.6 GiB
[ 1.021134] mmcblk0: p1 p2
[ 1.496120] random: fast init done
[ 2.717162] random: crng init done
[ 7.134649] Console: switching to colour frame buffer device 30x30
[ 7.142620] graphics fb0: fb_st7789v frame buffer, 240x240, 112 KiB video memory, 4 KiB buffer memory, fps=33, spi0.0 at 32 MHz
页次: 1