入手licheepi zero有几天了,这几天千辛万苦调试,只剩最后一步LCD驱动不起来
使用了sun8i-v3s-licheepi-zero-dock.dts的设置
进入u-boot时能显示企鹅图标和一行英文
进入kernel后,只有一个光标在左上角闪
运行demo,原本应该显示一个lvgl的demo,结果显示花屏,图片如下
启动日志如下
U-Boot SPL 2017.01-rc2-00073-gdd6e8740dc-dirty (Dec 12 2021 - 18:47:39)
DRAM: 64 MiB
Trying to boot from sunxi SPI
U-Boot 2017.01-rc2-00073-gdd6e8740dc-dirty (Dec 12 2021 - 18:47:39 +0800) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected xt25f128b with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
dotclock: 10000kHz = 10000kHz: (1 * 3MHz * 20) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
U-Boot 2017.01-rc2-00073-gdd6e8740dc-dirty (Dec 12 2021 - 18:47:39 +0800) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected xt25f128b with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
dotclock: 10000kHz = 10000kHz: (1 * 3MHz * 20) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
SF: Detected xt25f128b with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x10000
SF: 65536 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 41800000
Booting using the fdt blob at 0x41800000
Loading Device Tree to 42dfa000, end 42dffed9 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.13.16-licheepi-zero+ (yehao@ubuntu) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)) #7 SMP Sun Dec 12 17:14:38 CST 2021
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Zero with Dock
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] percpu: Embedded 16 pages/cpu @c3edf000 s33868 r8192 d23476 u65536
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16129
[ 0.000000] Kernel command line: console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 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: 54568K/65024K available (6144K kernel code, 217K rwdata, 1456K rodata, 1024K init, 264K bss, 10456K 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 : 0xc4000000 - 0xff800000 ( 952 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc3f80000 ( 63 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0700000 (7136 kB)
[ 0.000000] .init : 0xc0900000 - 0xc0a00000 (1024 kB)
[ 0.000000] .data : 0xc0a00000 - 0xc0a367c0 ( 218 kB)
[ 0.000000] .bss : 0xc0a3daf0 - 0xc0a7fcac ( 265 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000009] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.000021] Switching to timer-based delay loop, resolution 41ns
[ 0.000182] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000412] Console: colour dummy device 80x30
[ 0.000446] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[ 0.000460] pid_max: default: 32768 minimum: 301
[ 0.000588] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000601] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.001183] CPU: Testing write buffer coherency: ok
[ 0.001549] /cpus/cpu@0 missing clock-frequency property
[ 0.001572] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.002003] Setting up static identity map for 0x40100000 - 0x40100060
[ 0.002176] Hierarchical SRCU implementation.
[ 0.002689] smp: Bringing up secondary CPUs ...
[ 0.002702] smp: Brought up 1 node, 1 CPU
[ 0.002712] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[ 0.002718] CPU: All CPU(s) started in SVC mode.
[ 0.003481] devtmpfs: initialized
[ 0.006597] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.006889] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.006915] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.007079] pinctrl core: initialized pinctrl subsystem
[ 0.007938] random: get_random_u32 called from bucket_table_alloc+0xf4/0x244 with crng_init=0
[ 0.008074] NET: Registered protocol family 16
[ 0.008541] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.009644] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.009662] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.022894] SCSI subsystem initialized
[ 0.023194] usbcore: registered new interface driver usbfs
[ 0.023259] usbcore: registered new interface driver hub
[ 0.023351] usbcore: registered new device driver usb
[ 0.023595] pps_core: LinuxPPS API ver. 1 registered
[ 0.023605] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.023629] PTP clock support registered
[ 0.023860] Advanced Linux Sound Architecture Driver Initialized.
[ 0.025695] clocksource: Switched to clocksource arch_sys_counter
[ 0.036473] NET: Registered protocol family 2
[ 0.037048] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.037082] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.037108] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.037234] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.037283] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.037497] NET: Registered protocol family 1
[ 0.038071] RPC: Registered named UNIX socket transport module.
[ 0.038088] RPC: Registered udp transport module.
[ 0.038095] RPC: Registered tcp transport module.
[ 0.038101] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.040188] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.049069] NFS: Registering the id_resolver key type
[ 0.049118] Key type id_resolver registered
[ 0.049125] Key type id_legacy registered
[ 0.049169] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.050670] random: fast init done
[ 0.053542] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.053562] io scheduler noop registered
[ 0.053571] io scheduler deadline registered
[ 0.053847] io scheduler cfq registered (default)
[ 0.053859] io scheduler mq-deadline registered
[ 0.053865] io scheduler kyber registered
[ 0.058105] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.127012] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.130221] console [ttyS0] disabled
[ 0.150490] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 36, base_baud = 1500000) is a U6_16550A
[ 0.739555] console [ttyS0] enabled
[ 0.747600] m25p80 spi32766.0: xt25f128b (16384 Kbytes)
[ 0.752854] spi32766.0: parser cmdlinepart: 4
[ 0.757292] 4 cmdlinepart partitions found on MTD device spi32766.0
[ 0.763554] Creating 4 MTD partitions on "spi32766.0":
[ 0.768717] 0x000000000000-0x000000100000 : "uboot"
[ 0.774224] 0x000000100000-0x000000110000 : "dtb"
[ 0.779450] 0x000000110000-0x000000510000 : "kernel"
[ 0.784765] 0x000000510000-0x000001000000 : "rootfs"
[ 0.790613] libphy: Fixed MDIO Bus: probed
[ 0.795210] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[ 0.801095] dwmac-sun8i 1c30000.ethernet: No regulator found
[ 0.806836] dwmac-sun8i 1c30000.ethernet: Will use internal PHY
[ 0.812990] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[ 0.818695] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[ 0.825929] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[ 0.831582] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[ 0.838808] dwmac-sun8i 1c30000.ethernet: COE Type 2
[ 0.843767] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[ 0.850738] libphy: stmmac: probed
[ 0.856185] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.862723] ehci-platform: EHCI generic platform driver
[ 0.868291] ehci-platform 1c1a000.usb: EHCI Host Controller
[ 0.873906] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[ 0.881872] ehci-platform 1c1a000.usb: irq 26, io mem 0x01c1a000
[ 0.915713] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[ 0.922960] hub 1-0:1.0: USB hub found
[ 0.926907] hub 1-0:1.0: 1 port detected
[ 0.931424] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.937720] ohci-platform: OHCI generic platform driver
[ 0.943290] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[ 0.950036] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[ 0.957990] ohci-platform 1c1a400.usb: irq 27, io mem 0x01c1a400
[ 1.030835] hub 2-0:1.0: USB hub found
[ 1.034653] hub 2-0:1.0: 1 port detected
[ 1.042275] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 1.051858] input: 1c22800.lradc as /devices/platform/soc/1c22800.lradc/input/input0
[ 1.060770] sun6i-rtc 1c20400.rtc: rtc core: registered rtc-sun6i as rtc0
[ 1.067678] sun6i-rtc 1c20400.rtc: RTC enabled
[ 1.072217] i2c /dev entries driver
[ 1.077062] input: ns2009_ts as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input1
[ 1.086550] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.155746] sunxi-mmc 1c0f000.mmc: base:0xc407b000 irq:23
[ 1.215732] sunxi-mmc 1c10000.mmc: base:0xc4144000 irq:24
[ 1.222137] usbcore: registered new interface driver usbhid
[ 1.227791] usbhid: USB HID core driver
[ 1.233237] sun4i-codec 1c22c00.codec: ASoC: /soc/codec-analog@01c23000 not registered
[ 1.241274] sun4i-codec 1c22c00.codec: Failed to register our card
[ 1.248734] NET: Registered protocol family 17
[ 1.253306] Key type dns_resolver registered
[ 1.257839] Registering SWP/SWPB emulation handler
[ 1.270237] simple-framebuffer 43f80000.framebuffer: framebuffer at 0x43f80000, 0x7f800 bytes, mapped to 0xc4300000
[ 1.280863] simple-framebuffer 43f80000.framebuffer: format=x8r8g8b8, mode=480x272x32, linelength=1920
[ 1.293139] Console: switching to colour frame buffer device 60x34
[ 1.301598] simple-framebuffer 43f80000.framebuffer: fb0: simplefb registered!
[ 1.310153] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.321512] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.327358] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[ 1.336586] hub 3-0:1.0: USB hub found
[ 1.340470] hub 3-0:1.0: 1 port detected
[ 1.345530] using random self ethernet address
[ 1.350089] using random host ethernet address
[ 1.355641] usb0: HOST MAC da:57:2c:74:80:fd
[ 1.360062] usb0: MAC de:06:b8:44:88:b1
[ 1.363944] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.371460] g_cdc gadget: g_cdc ready
[ 1.377779] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
[ 1.387506] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01 01:27:11 UTC (5231)
[ 1.395987] vcc3v3: disabling
[ 1.398960] vcc5v0: disabling
[ 1.401924] ALSA device list:
[ 1.404886] #0: V3s Audio Codec
[ 1.447975] random: crng init done
[ 2.571907] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[ 2.578906] devtmpfs: mounted
[ 2.583092] Freeing unused kernel memory: 1024K
[ 3.492235] g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM)
Starting logging: OK
Initializing random number generator... done.
Starting network: OK
Welcome to Bairen
bairen login:
最近编辑记录 how0723 (2021-12-12 20:42:41)
离线
你的屏幕分辨率是多少呢?
离线
你的屏幕分辨率是多少呢?
480*272
离线
企鹅头像正常吗?
光标正常吗?
如果都正常, 说明很可能你的 lvgl app 设置的分辨率不是 480*272。
lvgl app 设置的分辨率可能不是 480*272,具体要查一下
企鹅头像正常,光标正常,但是用echo 0 > /sys/class/graphics/fb0/blank 会失败
离线
企鹅头像正常吗?
光标正常吗?
如果都正常, 说明很可能你的 lvgl app 设置的分辨率不是 480*272。
有没有其他简单的测试方法 ?
离线
buildroot 勾选 fbv 看图,或者 fb-test 测试程序可以测试lcd framebuffer
谢谢,我测试一下看看
离线
试试这个程序?
armgcc编译弄到板子上运行
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <stdlib.h>
static int fd_fb;
static struct fb_var_screeninfo var; /* Current var */
static struct fb_fix_screeninfo finfo;
static int screen_size;
static unsigned char *fb_base;
static unsigned int line_width;
static unsigned int pixel_width;
/**********************************************************************
* 函数名称: lcd_put_pixel
* 功能描述: 在LCD指定位置上输出指定颜色(描点)
* 输入参数: x坐标,y坐标,颜色
* 输出参数: 无
* 返 回 值: 会
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
* 2020/05/12 V1.0 zh(angenao) 创建
***********************************************************************/
void lcd_put_pixel(int x, int y, unsigned int color)
{
unsigned char *pen_8 = fb_base+y*line_width+x*pixel_width;
unsigned short *pen_16;
unsigned int *pen_32;
unsigned int red, green, blue;
pen_16 = (unsigned short *)pen_8;
pen_32 = (unsigned int *)pen_8;
switch (var.bits_per_pixel)
{
case 8:
{
*pen_8 = color;
break;
}
case 16:
{
/* 565 */
red = (color >> 16) & 0xff;
green = (color >> 8) & 0xff;
blue = (color >> 0) & 0xff;
color = ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3);
*pen_16 = color;
break;
}
case 24:
{
*pen_32=color;
break;
}
case 32:
{
*pen_32 = color;
break;
}
default:
{
printf("can't surport %dbpp\n", var.bits_per_pixel);
break;
}
}
}
int main(int argc, char **argv)
{
int i,j;
fd_fb = open("/dev/fb0", O_RDWR);
if (fd_fb < 0)
{
printf("can't open /dev/fb0\n");
return -1;
}
if (ioctl(fd_fb, FBIOGET_VSCREENINFO, &var))
{
printf("can't get var\n");
return -1;
}
if (ioctl(fd_fb,FBIOGET_FSCREENINFO,&finfo))
{
printf("Error reading fixed information\n");
exit(-1);
}
//显示结构体信息
printf("The mem is :%d\n",finfo.smem_len);
printf("The line_length is :%d\n",finfo.line_length);
printf("The xres is :%d\n",var.xres);
printf("The yres is :%d\n",var.yres);
printf("bits_per_pixel is :%d\n",var.bits_per_pixel);
line_width = var.xres * var.bits_per_pixel / 8;
pixel_width = var.bits_per_pixel / 8;
//计算显存大小
screen_size = var.xres * var.yres * var.bits_per_pixel / 8;
/*这就是把fp所指的文件中从开始到screensize大小的内容给映射出来,得到一个指向这块空间的指针*/
fb_base = (unsigned char *)mmap(NULL , screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_fb, 0);
if (fb_base == (unsigned char *)-1)
{
printf("can't mmap\n");
return -1;
}
/* 清屏: 全部设为白色 */
memset(fb_base, 0xff, screen_size);
for(i = 0 ; i < var.xres/2 ; i++)
for(j = 0 ; j < var.yres/2 ; j++)
lcd_put_pixel(i,j, 0xFF0000); //设为红色
for(i = var.xres/2 ; i < var.xres ; i++)
for(j = var.yres/2 ; j < var.yres ; j++)
lcd_put_pixel(i,j, 0xFF0000); //设为红色
munmap(fb_base , screen_size);/*解除映射*/
close(fd_fb); /*关闭文件*/
return 0;
}
离线
buildroot 勾选 fbv 看图,或者 fb-test 测试程序可以测试lcd framebuffer
用fb-test 应该是正常的,可以肯定之前是lvgl的分辨率设置有问题。
测试结果如下:
离线
离线