You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OrangePi 3 LTS编译ili9488的FBTFT驱动报错求助

问题描述

我有OrangePi 3 LTS和搭载ili9488的BTT TFT35 SPI v2.1显示屏,尝试通过SPI连接时发现系统自带的FBTFT目录里没有ili9488驱动。于是找了第三方FBTFT驱动编译,结果出错,想知道哪里操作错了。

系统信息

uname -a
Linux orangepi3-lts 6.6.31-current-sunxi64

编译错误信息

root@orangepi3-lts:/lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev# make -C /lib/modules/`uname -r`/build M=$PWD modules
make: Entering directory '/usr/src/linux-headers-6.6.31-current-sunxi64'
  CC [M]  /lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488/fbtft-core.o
/lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:
/lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488/fbtft-core.c:694:36: error: ‘FBINFO_FLAG_DEFAULT’ undeclared (first use in this function); did you mean ‘FAULT_FLAG_DEFAULT’?
  694 |         info->flags =              FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
      |                                    ^~~~~~~~~~~~~~~~~~~
      |                                    FAULT_FLAG_DEFAULT
/lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488/fbtft-core.c:694:36: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [scripts/Makefile.build:243: /lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488/fbtft-core.o] Error 1
make[2]: *** [scripts/Makefile.build:480: /lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev/fbtft-ili9488] Error 2
make[1]: *** [/usr/src/linux-headers-6.6.31-current-sunxi64/Makefile:1915: /lib/modules/6.6.31-current-sunxi64/build/drivers/video/fbdev] Error 2
make: *** [Makefile:234: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.6.31-current-sunxi64'

自定义设备树文件(sun50i-h6-spi-ili9488-led-always-on.dts)

/dts-v1/;
/plugin/;

/ {
        compatible = "xunlong,orangepi-3-lts","allwinner,sun50i-h6";


        fragment@0 {
                target-path = "/aliases";
                __overlay__ {
                        spi0 = "/soc/spi@5010000";
                        spi1 = "/soc/spi@5011000";
                };
        };

        fragment@2 {
               target = <&r_pio>;
                __overlay__ {
                        spi1_cs1_pin: spi1_cs1_pin {
                                pins = "PA8"; /* - real use PL8 but... error in calculate pin number 360!!!!*/
                                function = "gpio_out";
                                output-high;
                        };
                };
        };

        fragment@3 {
                 target = <&spi1>;
                 __overlay__ {
                            pinctrl-names = "default", "default";
                            pinctrl-1 = < &spi1_cs1_pin>;
                            cs-gpios = <0>, <&r_pio 0 8 0>; /* PL8 */

                            status = "okay";
                            debug=<0>;
                            #address-cells = <1>;
                            #size-cells = <0>;
                            spidev@0 {
                                     reg = <0>; /* Chip Select 0 */
                                     compatible = "spidev";
                                     spi-max-frequency = <100000000>;
                                     status = "disabled";
                            };
                            spidev@1 {
                                      reg = <1>; /* Chip Select 1 */
                                      compatible = "spidev";
                                      spi-max-frequency = <12000000>;
                                      status = "disabled";
                            };
                 };
        };

  fragment@4 {
    target = <&pio>;
    __overlay__ {
      ili9486_pins: ili9486_pins {
        pins = "PD21", "PD16"; /*RESET, DC_RS*/
        function = "gpio_out", "gpio_out" ;
      };
    };
  };
        fragment@5 {
                target = <&spi1>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;

                        cs-gpios = <0>, <&r_pio 0 8 0>; /* PL8 */
                        status = "okay";

                        ili9486: ili9486@0 {
                                compatible = "ilitek,ili9486";
                                spi-max-frequency = <24000000>;
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&ili9486_pins>;
                                        status = "okay";
                                debug=<0>;
                                txbuflen = <32768>;
                                rotate = <90>;
                                bgr = <0>;
                                fps = <60>;
                                buswidth = <8>;
                                regwidth = <16>;
                                reset-gpios = <&pio 3 21 0>; /*RST= PD21 */
                                dc-gpios = <&pio 3 16 0>; /*LCD_RS PD16 */
                                init = < 0x10000f1 0x36 0x04 0x00 0x3c 0x0f 0x8f 
                                0x10000f2 0x18 0xa3 0x12 0x02 0xb2 0x12 0xff 0x10 0x00 
                                0x10000f8 0x21 0x04 
                                0x10000f9 0x00 0x08 
                                0x1000036 0x08 
                                0x10000b4 0x00 
                                0x10000c1 0x41 
                                0x10000c5 0x00 0x91 0x80 0x00 
                                0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 
                                0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 
                                0x100003a 0x55 
                                0x1000011 
                                0x1000036 0x28 
                                0x20000ff 
                                0x1000029 >;
                        };
                };
        };
};

问题原因及解决步骤

1. 编译错误:FBINFO_FLAG_DEFAULT未定义

Linux内核6.0+版本中,FBINFO_FLAG_DEFAULT宏已被移除,替换为FBINFO_DEFAULT。修改驱动代码即可解决:

  • 打开fbtft-core.c文件,定位到第694行:
    info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
    
  • 将其替换为:
    info->flags = FBINFO_DEFAULT | FBINFO_VIRTFB;
    
  • 重新执行编译命令即可消除该错误。

2. 设备树文件的问题

(1) 兼容字符串不匹配

你的屏幕是ili9488,但DTS中写的是compatible = "ilitek,ili9486";,需修改为:

compatible = "ilitek,ili9488";

同时将节点名ili9486: ili9486@0改为ili9488: ili9488@0,引脚节点ili9486_pins改为ili9488_pins,保证命名一致性。

(2) 引脚配置错误

注释中提到实际想用PL8,但配置写的是PA8,需修正:
在fragment@2中,将pins = "PA8";改为:

pins = "PL8";

对应的cs-gpios里的<&r_pio 0 8 0>是正确的(r_pio对应PL组,0为端口组,8为引脚号),无需修改。

(3) 初始化指令适配

ili9488与ili9486的初始化指令存在差异,建议查找ili9488对应的FBTFT初始化参数替换当前的init数组,避免显示异常。

3. 编译与加载驱动

修改完代码和DTS后,按以下步骤操作:

  1. 重新编译驱动:
    make -C /lib/modules/`uname -r`/build M=$PWD modules
    
  2. 安装驱动模块:
    make -C /lib/modules/`uname -r`/build M=$PWD modules_install
    
  3. 编译设备树overlay:
    dtc -I dts -O dtb -o sun50i-h6-spi-ili9488-led-always-on.dtbo sun50i-h6-spi-ili9488-led-always-on.dts
    
  4. 将dtbo文件放到/boot/overlay-user/目录,修改/boot/armbianEnv.txt,添加overlay_user=sun50i-h6-spi-ili9488-led-always-on,重启系统加载。

内容的提问来源于stack exchange,提问作者denis doni

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 16:10:53