您尚未登录。

楼主 #1 2021-05-03 23:43:31

WangLY_Snot
会员
注册时间: 2019-12-21
已发帖子: 19
积分: 3

F1c100s是否成功启动SPI屏(st7789v)!?

F1c100s是否成功启动SPI屏(st7789v)!?

开发板:  LicheePi Nano
u-boot版本:   LicheePi-nano-u-boot-v2018.1
内核版本:Linux-5.7.1
SPI屏:st7789v

suniv-f1c100s.dtsi源代码
***************************************************************

#define SUN4I_DMA_NORMAL 0

/ {
	#address-cells = <1>;
	#size-cells = <1>;
	interrupt-parent = <&intc>;

	clocks {
		osc24M: clk-24M {
			#clock-cells = <0>;
			compatible = "fixed-clock";
			clock-frequency = <24000000>;
			clock-output-names = "osc24M";
		};

		osc32k: clk-32k {
			#clock-cells = <0>;
			compatible = "fixed-clock";
			clock-frequency = <32768>;
			clock-output-names = "osc32k";
		};
	};

	cpus {
		cpu {
			compatible = "arm,arm926ej-s";
			device_type = "cpu";
		};
	};
	
/*	de: display-engine {
		compatible = "allwinner,suniv-f1c100s-display-engine";
		allwinner,pipelines = <&fe0>;
		status = "disabled";
	};
*/
	soc {
		compatible = "simple-bus";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		sram-controller@1c00000 {
			compatible = "allwinner,suniv-f1c100s-system-control",
				     "allwinner,sun4i-a10-system-control";
			reg = <0x01c00000 0x30>;
			#address-cells = <1>;
			#size-cells = <1>;
			ranges;

			sram_d: sram@10000 {
				compatible = "mmio-sram";
				reg = <0x00010000 0x1000>;
				#address-cells = <1>;
				#size-cells = <1>;
				ranges = <0 0x00010000 0x1000>;

				otg_sram: sram-section@0 {
					compatible = "allwinner,suniv-f1c100s-sram-d",
						     "allwinner,sun4i-a10-sram-d";
					reg = <0x0000 0x1000>;
					status = "disabled";
				};
			};
		};

/*		tcon0: lcd-controller@1c0c000 {
			compatible = "allwinner,suniv-f1c100s-tcon";
			reg = <0x01c0c000 0x1000>;
			interrupts = <29>;
			clocks = <&ccu CLK_BUS_LCD>,
				 <&ccu CLK_TCON>;
			clock-names = "ahb",
				      "tcon-ch0";
			clock-output-names = "tcon-pixel-clock";
			resets = <&ccu RST_BUS_LCD>;
			reset-names = "lcd";
			status = "disabled";

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				tcon0_in: port@0 {
					#address-cells = <1>;
					#size-cells = <0>;
					reg = <0>;

					tcon0_in_be0: endpoint@0 {
						reg = <0>;
						remote-endpoint = <&be0_out_tcon0>;
					};
				};

				tcon0_out: port@1 {
					#address-cells = <1>;
					#size-cells = <0>;
					reg = <1>;
				};
			};
		};*/

		ccu: clock@1c20000 {
			compatible = "allwinner,suniv-f1c100s-ccu";
			reg = <0x01c20000 0x400>;
			clocks = <&osc24M>, <&osc32k>;
			clock-names = "hosc", "losc";
			#clock-cells = <1>;
			#reset-cells = <1>;
		};

		intc: interrupt-controller@1c20400 {
			compatible = "allwinner,suniv-f1c100s-ic";
			reg = <0x01c20400 0x400>;
			interrupt-controller;
			#interrupt-cells = <1>;
		};

		pio: pinctrl@1c20800 {
			compatible = "allwinner,suniv-f1c100s-pinctrl";
			reg = <0x01c20800 0x400>;
			interrupts = <38>, <39>, <40>;
			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
			clock-names = "apb", "hosc", "losc";
			gpio-controller;
			interrupt-controller;
			#interrupt-cells = <3>;
			#gpio-cells = <3>;

			uart0_pe_pins: uart0-pe-pins {
				pins = "PE0", "PE1";
				function = "uart0";
			};
			
			lcd_rgb666_pins: lcd-rgb666-pins {
				pins = "PD0", "PD1", "PD2", "PD3", "PD4",
				       "PD5", "PD6", "PD7", "PD8", "PD9",
				       "PD10", "PD11", "PD12", "PD13", "PD14",
				       "PD15", "PD16", "PD17", "PD18", "PD19",
				       "PD20", "PD21";
				function = "lcd";
			};
			
			mmc0_pins: mmc0-pins {
				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
				function = "mmc0";
			};

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

           	 spi1_pins: spi1-pins{
                	pins = "PA2","PA0","PA3","PA1";
                	function = "spi1";
            };


		};

		timer@1c20c00 {
			compatible = "allwinner,suniv-f1c100s-timer";
			reg = <0x01c20c00 0x90>;
			interrupts = <13>;
			clocks = <&osc24M>;
		};

		mmc0: mmc@1c0f000 {
			compatible = "allwinner,suniv-f1c100s-mmc",
				     "allwinner,sun7i-a20-mmc";
			reg = <0x01c0f000 0x1000>;
			clocks = <&ccu CLK_BUS_MMC0>,
				 <&ccu CLK_MMC0>,
				 <&ccu CLK_MMC0_OUTPUT>,
				 <&ccu CLK_MMC0_SAMPLE>;
			clock-names = "ahb",
					      "mmc",
					      "output",
				    	  "sample";
			resets = <&ccu RST_BUS_MMC0>;
			reset-names = "ahb";
			interrupts = <23>;
			pinctrl-names = "default";
			pinctrl-0 = <&mmc0_pins>;
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		wdt: watchdog@1c20ca0 {
			compatible = "allwinner,suniv-f1c100s-wdt",
				     "allwinner,sun4i-a10-wdt";
			reg = <0x01c20ca0 0x20>;
		};

		uart0: serial@1c25000 {
			compatible = "snps,dw-apb-uart";
			reg = <0x01c25000 0x400>;
			interrupts = <1>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART0>;
			resets = <&ccu RST_BUS_UART0>;
			status = "disabled";
		};

		uart1: serial@1c25400 {
			compatible = "snps,dw-apb-uart";
			reg = <0x01c25400 0x400>;
			interrupts = <2>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART1>;
			resets = <&ccu RST_BUS_UART1>;
			status = "disabled";
		};

		uart2: serial@1c25800 {
			compatible = "snps,dw-apb-uart";
			reg = <0x01c25800 0x400>;
			interrupts = <3>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART2>;
			resets = <&ccu RST_BUS_UART2>;
			status = "disabled";
		};
		usb_otg: usb@1c13000 {
			compatible = "allwinner,suniv-musb";
			reg = <0x01c13000 0x0400>;
			clocks = <&ccu CLK_BUS_OTG>;
			resets = <&ccu RST_BUS_OTG>;
			interrupts = <26>;
			interrupt-names = "mc";
			phys = <&usbphy 0>;
			phy-names = "usb";
			extcon = <&usbphy 0>;
			allwinner,sram = <&otg_sram 1>;
			status = "disabled";
		};

		usbphy: phy@1c13400 {
			compatible = "allwinner,suniv-usb-phy";
			reg = <0x01c13400 0x10>;
			reg-names = "phy_ctrl";
			clocks = <&ccu CLK_USB_PHY0>;
			clock-names = "usb0_phy";
			resets = <&ccu RST_USB_PHY0>;
			reset-names = "usb0_reset";
			#phy-cells = <1>;
			status = "disabled";
		};

		/*
		fe0: display-frontend@1e00000 {
			compatible = "allwinner,suniv-f1c100s-display-frontend";
			reg = <0x01e00000 0x20000>;
			interrupts = <30>;
			clocks = <&ccu CLK_BUS_DE_FE>, <&ccu CLK_DE_FE>,
				 <&ccu CLK_DRAM_DE_FE>;
			clock-names = "ahb", "mod",
				      "ram";
			resets = <&ccu RST_BUS_DE_FE>;
			status = "disabled";

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				fe0_out: port@1 {
					#address-cells = <1>;
					#size-cells = <0>;
					reg = <1>;

					fe0_out_be0: endpoint@0 {
						reg = <0>;
						remote-endpoint = <&be0_in_fe0>;
					};
				};
			};
		};

		be0: display-backend@1e60000 {
			compatible = "allwinner,suniv-f1c100s-display-backend";
			reg = <0x01e60000 0x10000>;
			reg-names = "be";
			interrupts = <31>;
			clocks = <&ccu CLK_BUS_DE_BE>, <&ccu CLK_DE_BE>,
				 <&ccu CLK_DRAM_DE_BE>;
			clock-names = "ahb", "mod",
				      "ram";
			resets = <&ccu RST_BUS_DE_BE>;
			reset-names = "be";
			assigned-clocks = <&ccu CLK_DE_BE>;
			assigned-clock-rates = <300000000>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				be0_in: port@0 {
					#address-cells = <1>;
					#size-cells = <0>;
					reg = <0>;

					be0_in_fe0: endpoint@0 {
						reg = <0>;
						remote-endpoint = <&fe0_out_be0>;
					};
				};

				be0_out: port@1 {
					#address-cells = <1>;
					#size-cells = <0>;
					reg = <1>;

					be0_out_tcon0: endpoint@0 {
						reg = <0>;
						remote-endpoint = <&tcon0_in_be0>;
					};
				};
			};
		};   */


		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>;
        };

        spi1:spi@1c06000 {
            compatible = "allwinner,suniv-spi", "allwinner,sun8i-h3-spi";
            reg = <0x1c06000 0x1000>;
            interrupts = <0xb>;
            clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_BUS_SPI1>;
            clock-names = "ahb", "mod";
            resets = <&ccu RST_BUS_SPI1>;
            status = "okay";
            #address-cells = <1>;
            #size-cells = <0>;
            bias-pull-up;
            pinctrl-names = "default";
            pinctrl-0 = <&spi1_pins>;
        };

        dma: dma-controller@1c02000 {
			compatible = "allwinner,suniv-f1c100s-dma";
			reg = <0x01c02000 0x1000>;
			interrupts = <18>;
			clocks = <&ccu CLK_BUS_DMA>;
			resets = <&ccu RST_BUS_DMA>;
			#dma-cells = <2>;
		};

        codec: codec@1c23c00 {
			compatible = "allwinner,suniv-f1c100s-codec";
			reg = <0x01c23c00 0x400>;
			interrupts = <21>;
			clocks = <&ccu CLK_BUS_CODEC>,
				 <&ccu CLK_CODEC>;
			clock-names = "apb", "codec";
			resets = <&ccu RST_BUS_CODEC>;
			dmas = <&dma SUN4I_DMA_NORMAL 0x0c>, 
				   <&dma SUN4I_DMA_NORMAL 0x0c>;
			dma-names = "rx", "tx";
			status = "disabled";
		};
	};
};

suniv-f1c100s.dts源代码
***************************************************************

// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/*
 * Copyright 2018 Icenowy Zheng <icenowy@aosc.io>
 */

/dts-v1/;
#include "suniv-f1c100s.dtsi"

/ {
	model = "Lichee Pi Nano";
	compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s";

	aliases {
		serial0 = &uart0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	reg_vcc3v3: vcc3v3 {
                compatible = "regulator-fixed";
                regulator-name = "vcc3v3";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
        };

};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pe_pins>;
	status = "okay";
};


&mmc0 {
        vmmc-supply = <&reg_vcc3v3>;
        bus-width = <4>;
        broken-cd;
        status = "okay";
};



&otg_sram {
        status = "okay";
};

&usb_otg {
        dr_mode = "otg";
        status = "okay";
};

&usbphy {
        usb0_id_det-gpio = <&pio 4 2 0>; /* PE2 */
        status = "okay";
};


&spi1 {
    st7789v@0 {
        status = "okay";
        compatible = "sitronix,st7789v";
               reg = <0>;
               spi-max-frequency = <32000000>;
               rotate = <0>;
               spi-cpol;
               spi-cpha;
               rgb;
               fps = <30>;
               buswidth = <8>;
			   reset-gpios=<&pio 4 3 1>;
               dc-gpios = <&pio 4 5 1>;
               debug = <0>;
        };
}; 

&codec {
  allwinner,audio-routing =
    "Headphone", "HP",
    "Headphone", "HPCOM",
    "LINEIN", "Line In",
    "FMINL", "Left FM In",
    "FMINR", "Right FM In",
    "MIC", "Mic";
  status = "okay";
};

编译完成后,将suniv-f1c100s.dtb和zImage拷贝到SD卡第一分区boot当中,
连接电脑,串口打印uboot以及linux内核启动信息,
屏幕一开始嘿嘿的,接着雪花花屏一闪而过,最后黑屏,同时左上角光标不停闪烁。

输入以下内容,屏幕有反应,但是都是雪花点点。。。

echo "Hello" > /dev/fb0
cat /dev/random > /dev/fb0
sl > /dev/fb0

有图为证:
FluxBB bbcode 测试
FluxBB bbcode 测试
FluxBB bbcode 测试


输入以下内容,屏幕正常显示。。。

echo "Hello" > /dev/tty0
cat /dev/random > /dev/tty0
sl > /dev/tty0

有图为证:
FluxBB bbcode 测试
FluxBB bbcode 测试
FluxBB bbcode 测试



***************************************************
测试framebuffer:

root#pi: ~/fb-test
root#pi: ~/mplayer cc.mp4

有图为证:
FluxBB bbcode 测试
FluxBB bbcode 测试


***************************************************************

想不明白啊 。
内核启动的时候,屏幕为何没有打印启动信息,偏偏是花屏一闪而过。
输入"echo ‘Hello, World!!!!!!!!!!!‘  > /dev/fb0",屏幕显示若干个光点。。
莫非字符内容全部显示为光点了?

这是什么原因啊。;?

设备树写对了吗??????????????????

tongue   tongue  tongue  tongue  tongue
请大佬指教。。。。
本人初学linux ,深感亚历山大啊。。。

最近编辑记录 WangLY_Snot (2021-05-03 23:57:32)

离线

楼主 #3 2021-05-04 00:10:05

WangLY_Snot
会员
注册时间: 2019-12-21
已发帖子: 19
积分: 3

Re: F1c100s是否成功启动SPI屏(st7789v)!?

raspberryman 说:

bootargs console 改为 fb0才行吧

试过了没用。。。。
bootargs :   console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw
bootcmd:    load mmc 0:1 0x80008000 zImage;load mmc 0:1 0x80c08000 suniv-f1c100s.deb; bootz 0x80008000 - 0x80c08000

离线

楼主 #4 2021-05-06 12:58:10

WangLY_Snot
会员
注册时间: 2019-12-21
已发帖子: 19
积分: 3

Re: F1c100s是否成功启动SPI屏(st7789v)!?

试着输入下列代码看看。。。。。

=>setenv bootargs "console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw  vt.global_cursor_default=0"
=>saveenv

此时编译的linux是可以在SPI屏和串口同时输出log的,但是SPI屏端还不是控制台,无法使用USB键盘进行控制!!!!
此时编译的linux是可以在SPI屏和串口同时输出log的,但是SPI屏端还不是控制台,无法使用USB键盘进行控制!!!!
此时编译的linux是可以在SPI屏和串口同时输出log的,但是SPI屏端还不是控制台,无法使用USB键盘进行控制!!!!

关键之处在于这个文件/etc/inittab

我在这里面注释了console这一行语句。
添加了下面两行:;

ttyS0::respawn:-/bin/sh
tty0::respawn:-bin/sh

还是不能实现SPI屏被键盘控制字符输入。。。。。
大家有没有办法啊???

最近编辑记录 WangLY_Snot (2021-05-07 09:50:10)

离线

楼主 #6 2021-05-07 10:23:18

WangLY_Snot
会员
注册时间: 2019-12-21
已发帖子: 19
积分: 3

Re: F1c100s是否成功启动SPI屏(st7789v)!?

raspberryman 说:

usb键盘? 这个有点复杂吧?

首先确保你的usb键盘工作正常,用evtest测试,然后还要做别的处理才行。

晚上试试看,,,只有这样,才是一台小电脑啊。。。哈哈。。。。。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn