Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    麻雀 d1s spi tft 开坑

    MR Series
    5
    31
    9344
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      soso90 LV 7 last edited by

      手上有个st7789的屏,开坑,驱动这个屏,目前spi0引出到spi flash,空间比较小。不好飞线。考虑使用gpio模拟或是spi1.有使用经验的朋友可以交流一下

      Y 1 Reply Last reply Reply Quote Share 0
      • Y
        yelong98 LV 7 @soso90 last edited by

        @soso90 模拟的就算了,跟幻灯片一样,还拉窗帘

        S 1 Reply Last reply Reply Quote Share 0
        • Y
          YterAA LV 7 last edited by

          可以用spi1挂fbtft上

          S 1 Reply Last reply Reply Quote Share 0
          • S
            soso90 LV 7 @yelong98 last edited by

            @yelong98 能达到多大帧率,应该不至于很卡吧~~

            Y 1 Reply Last reply Reply Quote Share 0
            • Y
              YterAA LV 7 @soso90 last edited by

              @soso90 模拟io是一行一行刷,我觉得挺卡的,不过这东西也不支持dma

              1 Reply Last reply Reply Quote Share 0
              • S
                soso90 LV 7 @YterAA last edited by YuzukiTsuru

                @yteraa
                按照spi0的方法,配置了spi1,查看到有这么个错误。

                root@TinaLinux:/# dmesg |grep spi
                [    2.582189] sunxi_spi_probe()2476 - [spi1] Req mem region failed
                

                以下是dts配置:

                	spi1_pins_a: spi1@0 {
                		pins = "PD11", "PD12"; /* clk, mosi */
                		function = "spi1";
                		drive-strength = <10>;
                	};
                
                	spi1_pins_b: spi1@1 {
                		pins = "PD10" ;
                		function = "spi1";
                		drive-strength = <10>;
                		bias-pull-up;   /* cs */
                	};
                
                
                &spi1 {
                	clock-frequency = <100000000>;
                	pinctrl-0 = <&spi1_pins_a &spi1_pins_b>;
                	//pinctrl-1 = <&spi1_pins_c>;
                	//pinctrl-names = "default";
                	//spi_slave_mode = <0>;
                	//spi1_cs_number = <1>;
                	//spi1_cs_bitmap = <1>;
                	//spi_dbi_enable = <1>;
                	status = "okay";
                    st7789v@0 {
                        status = "okay";
                        compatible = "sitronix,st7789v";
                        reg = <0>;
                        spi-max-frequency = <32000000>;
                        rotate = <90>;
                        rgb;
                        fps = <30>;
                        buswidth = <8>;
                        reset = <&pio PD 13 GPIO_ACTIVE_LOW>;
                        dc = <&pio PD 14 GPIO_ACTIVE_LOW>;
                        led = <&pio PD 15 GPIO_ACTIVE_HIGH>;
                        debug = <1>;
                    };
                
                };
                
                &disp {
                	disp_init_enable = <0>;
                    ......
                }
                
                &lcd0 {
                	lcd_used = <0>;
                    ......
                }
                
                &hdmi {
                	hdmi_used = <0>;
                    ......
                }
                

                以上。参考大神帖子:https://blog.csdn.net/weixin_43094346/article/details/123088068board.dts

                Y 1 Reply Last reply Reply Quote Share 0
                • Y
                  YterAA LV 7 @soso90 last edited by YuzukiTsuru

                  @soso90

                  修改 \lichee\linux-5.4\arch\riscv\boot\dts\sunxi\sun20iw1p1.dtsi spi1部分,reg = <0x0 0x04026000 0x0 0x1000>; 改成 reg = <0x0 0x04026000 0x0 0x300>;

                  spi1: spi@4026000 {
                  	#address-cells = <1>;
                  	#size-cells = <0>;
                  	compatible = "allwinner,sun20i-spi";
                  	reg = <0x0 0x04026000 0x0 0x300>;
                  	interrupts-extended = <&plic0 32 IRQ_TYPE_LEVEL_HIGH>;
                  	clocks = <&ccu CLK_PLL_PERIPH0>, <&ccu CLK_SPI1>, <&ccu CLK_BUS_SPI1>;
                  	clock-names = "pll", "mod", "bus";
                  	resets = <&ccu RST_BUS_SPI1>;
                  	clock-frequency = <100000000>;
                  	spi1_cs_number = <1>;
                  	spi1_cs_bitmap = <1>;
                  	dmas = <&dma 23>, <&dma 23>;
                  	dma-names = "tx", "rx";
                  	status = "disabled";
                  };
                  

                  参考user manel
                  bf966103-22c0-42dd-bf94-59f6d6a3af7b-image.png

                  S 1 Reply Last reply Reply Quote Share 0
                  • S
                    soso90 LV 7 @YterAA last edited by

                    @yteraa 按照你说的,改了spi的范围,重新make和pack,还是报这个错误。是哪里还要配置?谢谢哈~ 看来这个东西,应该玩的人也少😊

                    Y 1 Reply Last reply Reply Quote Share 0
                    • Y
                      YterAA LV 7 @soso90 last edited by

                      @soso90 fb_tft有没有什么输出信息

                      S 2 Replies Last reply Reply Quote Share 0
                      • S
                        soso90 LV 7 @YterAA last edited by

                        @yteraa fbtft没有输出,spi这边还是报那个申请失败:sunxi_spi_probe()2476 - [spi1] Req mem region failed。这个spi失败的话,后面应该也不会去挂载fbtft吧

                        1 Reply Last reply Reply Quote Share 0
                        • S
                          soso90 LV 7 @YterAA last edited by YuzukiTsuru

                          @yteraa 今天发现串口有更详细的spi日志,dmesg居然没打印出来

                          [    0.172839] spi spi1: spi1 supply spi not found, using dummy regulator
                          [    0.173158] sunxi_spi_resource_get()2062 - [spi1] SPI MASTER MODE
                          [    0.173322] sunxi_spi_select_gpio_state()2005 - [spi1] pinctrl_lookup_state(default) failed! return ffffffffffffffed
                          [    0.173335] sunxi_spi_resource_get()2065 - [spi1] Request GPIO failed!
                          [    0.173342] sunxi_spi_probe()2494 - [spi1] resource get error
                          [    0.173623] spi: probe of spi1 failed with error -22
                          
                          [    2.536895] [DISP] bsp_disp_sync_with_hw,line:657:
                          [    2.536900] Can't find device(1) for manager 0
                          [    2.571469] sunxi_spi_probe()2476 - [spi1] Req mem region failed
                          [    2.578284] ------------[ cut here ]------------
                          [    2.583436] Trying to free already-free IRQ 32
                          [    2.588410] WARNING: CPU: 0 PID: 13 at kernel/irq/manage.c:1737 __free_irq+0x7a/0x25a
                          [    2.597137] Modules linked in:
                          [    2.600544] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted 5.4.61 #10
                          [    2.607539] Workqueue: events deferred_probe_work_func
                          [    2.613268] sepc: ffffffe000061598 ra : ffffffe000061598 sp : ffffffe002f23b80
                          [    2.621318]  gp : ffffffe0008eb600 tp : ffffffe002f08ac0 t0 : ffffffe0008fa368
                          [    2.629366]  t1 : 0000000000000064 t2 : 0000000000000009 s0 : ffffffe002f23bc0
                          [    2.637415]  s1 : ffffffe001844638 a0 : 0000000000000022 a1 : 000000000000000a
                          [    2.645463]  a2 : 0000000000000087 a3 : ffffffe000858ea0 a4 : ffffffe000858e08
                          [    2.653511]  a5 : 0000000000000001 a6 : 0000000000000133 a7 : 0000000000000000
                          [    2.661559]  s2 : ffffffe002f3ec00 s3 : ffffffe001844638 s4 : 0000000200000022
                          [    2.669607]  s5 : ffffffe002f3ed50 s6 : 0000000000000020 s7 : 0000000000000000
                          [    2.677654]  s8 : 0000000000000001 s9 : ffffffffffffffff s10: 0000000000000001
                          [    2.685703]  s11: ffffffe002efda80 t3 : ffffffe0008f4b00 t4 : 0000000000001570
                          [    2.693750]  t5 : 0000000000001570 t6 : ffffffe0008f5089
                          [    2.699667] sstatus: 0000000200000100 sbadaddr: 0000000000000000 scause: 0000000000000003
                          [    2.708780] ---[ end trace 0d66c23407f86d75 ]---
                          
                          Y S 3 Replies Last reply Reply Quote Share 0
                          • S
                            soso90 LV 7 @soso90 last edited by YuzukiTsuru

                            修改了报错。现在能挂载上驱动。不过启动后,居然挂载不了根目录

                            [    3.085565] HDMI2.0 module init end
                            [    3.089553] [DISP] bsp_disp_sync_with_hw,line:657:
                            [    3.089560] Can't find device(1) for manager 0
                            [    3.123954] twi twi2: twi2 supply twi not found, using dummy regulator
                            [    3.138531] sunxi_i2c_probe()2262 - [i2c2] probe success
                            [    3.148565] debugfs: Directory '2034000.daudio' with parent 'sndhdmi' already present!
                            [    3.159575] sunxi-audio-card 20340a0.sounddaudio2: 20340a4.hdmiaudio <-> 2034000.daudio mapping ok
                            [    3.171753] get det_vbus is fail, -84
                            [    3.175843] get id is fail, -84
                            [    3.180837] cfg80211: Loading compiled-in X.509 certificates for regulatory database
                            [    3.192169] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
                            [    3.199858] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
                            [    3.209561] clk: Not disabling unused clocks
                            [    3.214334] ALSA device list:
                            [    3.217807] cfg80211: failed to load regulatory.db
                            [    3.223249]   #0: audiocodec
                            [    3.226549]   #1: sndhdmi
                            [    3.229990] VFS: Cannot open root device "mmcblk0p5" or unknown-block(0,0): error -6
                            [    3.238747] Please append a correct "root=" boot option; here are the available partitions:
                            [    3.248148] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
                            [    3.257372] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.61 #10
                            [    3.263870] Call Trace:
                            [    3.266613] [<ffffffe0000333ce>] walk_stackframe+0x0/0xa0
                            [    3.272632] [<ffffffe0000335b0>] show_stack+0x2a/0x34
                            [    3.278264] [<ffffffe000618532>] dump_stack+0x20/0x28
                            [    3.283897] [<ffffffe000038376>] panic+0xee/0x2b6
                            [    3.289142] [<ffffffe000000eda>] mount_block_root+0x1ee/0x28a
                            [    3.295546] [<ffffffe000000ffc>] mount_root+0x86/0x90
                            [    3.301178] [<ffffffe000001116>] prepare_namespace+0x110/0x152
                            [    3.307680] [<ffffffe000000b78>] kernel_init_freeable+0x17e/0x19a
                            [    3.314478] [<ffffffe00062be42>] kernel_init+0x12/0xee
                            [    3.320206] [<ffffffe000032018>] ret_from_exception+0x0/0xc
                            [    3.326421] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
                            
                            G 1 Reply Last reply Reply Quote Share 0
                            • Y
                              YterAA LV 7 @soso90 last edited by

                              @soso90
                              sunxi_spi_resource_get()2065 - [spi1] Request GPIO failed!

                              SPI的IO被其他功能占用了,看看是不是被LCD显示屏lcd0节点占用了。如果是,释放IO即可

                              1 Reply Last reply Reply Quote Share 0
                              • Y
                                YterAA LV 7 @soso90 last edited by

                                @soso90 顺便把那个0x300改回去((

                                S 1 Reply Last reply Reply Quote Share 0
                                • S
                                  soso90 LV 7 @YterAA last edited by

                                  @yteraa 现在能识别,也正常挂载7789,就是系统根目录挂不了。真是奇怪~~没有改其他地方,就加了一个pin-name加了default这个,之前dts少了这个,才报申请io失败

                                  Y 1 Reply Last reply Reply Quote Share 0
                                  • Y
                                    YterAA LV 7 @soso90 last edited by

                                    @soso90 是spi flash启动还是tf启动

                                    S 1 Reply Last reply Reply Quote Share 0
                                    • S
                                      soso90 LV 7 @YterAA last edited by

                                      @yteraa 22222.png tf卡启动,没有修改到tf卡相关。只是添加了spi和改了你说的寄存器范围。刚才spi的dts错误的话,还能识别到。看日志好像现在是识别不到tf卡。

                                      S 1 Reply Last reply Reply Quote Share 0
                                      • S
                                        soso90 LV 7 @soso90 last edited by

                                        @soso90 在 麻雀 d1s spi tft 开坑 中说:

                                        @yteraa 22222.png tf卡启动,没有修改到tf卡相关。只是添加了spi和改了你说的寄存器范围。刚才spi的dts错误的话,还能识别到。看日志好像现在是识别不到tf卡。

                                        初步判断,有可能是io口引用冲突导致。这边有个疑问,d1s少了部分io。那么io计算方法是否还是和d1一致,也是按照每个pin有多少个做偏移,还是按照固定的io数去计算

                                        Y 1 Reply Last reply Reply Quote Share 0
                                        • Y
                                          YterAA LV 7 @soso90 last edited by

                                          @soso90 计算都是一样的,检查下是不是tf部分的mmc有问题

                                          S 1 Reply Last reply Reply Quote Share 0
                                          • S
                                            soso90 LV 7 @YterAA last edited by

                                            @yteraa 可以显示了。不过偏移有问题,还有错位了,迟些上图片,

                                            YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
                                            • YuzukiTsuru
                                              柚木 鉉 LV 9 @soso90 last edited by

                                              @soso90 错位改成卖家给的资料包里的偏移,这个屏幕我买过几家不同的,初始化偏移都不太一样

                                              S 1 Reply Last reply Reply Quote Share 0
                                              • S
                                                soso90 LV 7 @YuzukiTsuru last edited by YuzukiTsuru

                                                @yuzukitsuru
                                                微信图片编辑_20220704095655.jpg

                                                1.应该是你说的偏移问题。 2这种图片显示异常,是原点坐标不对导致?

                                                YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
                                                • YuzukiTsuru
                                                  柚木 鉉 LV 9 @soso90 last edited by YuzukiTsuru

                                                  @soso90
                                                  你用的是135240的驱动,要改成240240的驱动

                                                  1)修改这里的偏移

                                                  static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
                                                  			       int ye)
                                                  {
                                                  	switch(par->info->var.rotate)
                                                  	{
                                                  		case   0: xs+=53;xe+=53;ys+=40;ye+=40;
                                                  				 break;
                                                  		case  90: xs+=40;xe+=40;ys+=53;ye+=53;
                                                  				 break;
                                                  		case 180: xs+=53;xe+=53;ys+=40;ye+=40;
                                                  				 break;
                                                  		case 270: xs+=40;xe+=40;ys+=53;ye+=53;
                                                  				 break;
                                                  		default :
                                                  				 break;
                                                  	}
                                                  
                                                  	write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
                                                  		  (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
                                                  
                                                  	write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
                                                  		  (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
                                                  
                                                  	write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
                                                  }
                                                  

                                                  2)修改这里的初始化代码,我这里的是135*240的

                                                  static int init_display(struct fbtft_par *par)
                                                  {
                                                      par->fbtftops.reset(par);
                                                      mdelay(50);
                                                      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,0x19);
                                                      write_reg(par,0xC0,0x2C);
                                                      write_reg(par,0xC2,0x01);
                                                      write_reg(par,0xC3,0x12);
                                                      write_reg(par,0xC4,0x20);
                                                      write_reg(par,0xC6,0x0F);
                                                      write_reg(par,0xD0,0xA4,0xA1);
                                                      write_reg(par,0xE0,0xD0,0x04,0x0D,0x11,0x13,0x2B,0x3F,0x54,0x4C,0x18,0x0D,0x0B,0x1F,0x23);
                                                      write_reg(par,0xE1,0xD0,0x04,0x0C,0x11,0x13,0x2C,0x3F,0x44,0x51,0x2F,0x1F,0x1F,0x20,0x23);
                                                      write_reg(par,0x21);
                                                      write_reg(par,0x11);
                                                      mdelay(50);
                                                      write_reg(par,0x29);
                                                      mdelay(200);
                                                      return 0;
                                                  }
                                                  

                                                  3)修改这里屏幕分辨率

                                                  static struct fbtft_display display = {
                                                  	.regwidth = 8,
                                                  	.width = 135,
                                                  	.height = 240,
                                                  	.gamma_num = 2,
                                                  	.gamma_len = 14,
                                                  	.gamma = DEFAULT_GAMMA,
                                                  	.fbtftops = {
                                                  		.init_display = init_display,
                                                  		.set_var = set_var,
                                                  		.set_gamma = set_gamma,
                                                  		.blank = blank,
                                                  	},
                                                  };
                                                  

                                                  以上资料屏幕厂商会提供

                                                  S 1 Reply Last reply Reply Quote Share 0
                                                  • S
                                                    soso90 LV 7 @YuzukiTsuru last edited by

                                                    @yuzukitsuru 分辨率已经修改。我的是240*280~~ ,偏移还没改,我晚点试试~~

                                                    S 1 Reply Last reply Reply Quote Share 0
                                                    • Referenced by  S soso90 
                                                    • Referenced by  S soso90 
                                                    • Referenced by  S soso90 
                                                    • S
                                                      soso90 LV 7 @soso90 last edited by

                                                      结贴,后续见 :https://bbs.aw-ol.com/topic/1658/v853开发板填坑记/3

                                                      1 Reply Last reply Reply Quote Share 0
                                                      • G
                                                        ggy321 LV 3 @soso90 last edited by

                                                        @soso90 大佬这个报错怎么解决的?我一路跟您走来报了一模一样的错误😵

                                                        S 1 Reply Last reply Reply Quote Share 0
                                                        • S
                                                          soso90 LV 7 @ggy321 last edited by

                                                          @ggy321 哪个错误。dts错误?dts要在spi1上添加上pinctrl-names = "default";

                                                          G S 2 Replies Last reply Reply Quote Share 0
                                                          • G
                                                            ggy321 LV 3 @soso90 last edited by

                                                            @soso90 感谢大佬,我是挂载不了根目录,查了一下是sd的引脚冲突了😂

                                                            1 Reply Last reply Reply Quote Share 0
                                                            • S
                                                              soso90 LV 7 last edited by

                                                              @ggy321 你用的是哪个sdk。我用的是网盘那个,居然无线不行。。。你的无线正常不。我连设备都没识别到

                                                              G 1 Reply Last reply Reply Quote Share 0
                                                              • G
                                                                ggy321 LV 3 @soso90 last edited by xiaowenge

                                                                @soso90 https://bbs.aw-ol.com/topic/1256/芒果派-mq-pro-mq-的板级配置文件
                                                                可以看一下这个,我还没到这一步

                                                                1 Reply Last reply Reply Quote Share 0
                                                                • S
                                                                  soso90 LV 7 @soso90 last edited by

                                                                  https://www.bilibili.com/video/BV1bB4y1z7FY?spm_id_from=444.41.list.card_archive.click&vd_source=5bd1cb1eb42515f034a1fbba36e708e0

                                                                  这个屏esp32+lvgl效果。暂时不研究跑在d1s+lvgl效果。这个坑,给其他人填了~

                                                                  1 Reply Last reply Reply Quote Share 0
                                                                  • 1 / 1
                                                                  • First post
                                                                    Last post

                                                                  Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                                                                  行为准则 | 用户协议 | 隐私权政策