Planck-pi fbtft 驱动移植ST7735屏

## 修改设备树

在suniv-f1c100s.dtsi添加Planck-pi的SPI0管脚(PC0->CLK, PC1->CS, PC2->MISO, PC3->MOSI)

spi0_pins: spi0-pins{
               	pins = "PC0", "PC1", "PC2", "PC3";
                function = "spi0";
}

                 spi0:spi@1c05000 {
                        compatible = "allwinner,suniv-spi", "allwinner,sun8i-h3-spi";
                         reg = <0x1c05000 0x1000>;
                        interrupts =<0xa>;
                         clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
                        clock-names = "ahb", "mod";
                        resets = <&ccu RST_BUS_SPI0>;
                        status = "okay";
                        #address-cells =<1>;
                        #size-cells =<0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&spi0_pins>;

                };

 在suniv-f1c100s-licheepi-nano.dts中创建st7735s@0节点(PD0->DC, PD1->reset)

&spi0 {
        //status ="okay";
        st7735r@0 {
            status ="okay";
            compatible = "sitronix,st7735r";
               reg = <0>;
               spi-max-frequency =<48000000>;        //SPI时钟50M
               rotate =<90>;                    //屏幕旋转90度
               spi-cpol;
               spi-cpha;
               rgb;                           //颜色格式RGB
               fps =<30>;                      //刷新30帧率
               buswidth =<8>;                   //总线宽度8
               dc-gpios  =<&pio 3 0 GPIO_ACTIVE_LOW>;   //GPIOD0
               reset-gpios=<&pio 3 1 GPIO_ACTIVE_LOW>;   //GPIOD1 暂时测试后面dc板子会改成pb4
               debug =<0>;                     //不开启调试
        };

## 修改fbtft-core.c文件

1 添加头文件

#include "linux/gpio.h"
#include "linux/of_gpio.h"

2 修改函数

fbtft_request_one_gpio,   fbtft_request_gpios, fbtft_reset    三个函数 

## make menuconfig 编译选项

1.SPI驱动的时候必须选择A31(Device Drivers -> SPI support)

2. Device Drivers  --->  

    [*] Staging drivers  --->  

        <*>   Support for small TFT LCD display modules  --->

              <*>   FB driver for the ST7735R LCD Controller 

## 测试

ST7735S屏接线说明:(BL->3.3V, SDA->MOSI。其他的对应即可)  。SPI0的MISO脚不接,因为只向屏幕写数据。

将编译的内核zImage 和dtb文件替换tf卡内的文件即可。

cat /dev/urandom > /dev/fb0  屏幕有雪花点 说明驱动成功。

与终端交互   ls / > /dev/tty0

参考:

SPI LCD驱动移植(基于fbtft)

记录为Linux配置spi屏幕(st7735s)

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值