RK3399 原理图

驱动学习

Posted by LXG on September 1, 2022

标准电路图符号

硬件接口四大类

  1. GPIO和门电路
  2. 协议类
  3. 类似内存的接口
  4. 模拟电路

GPIO 和 门电路

GPIO:通用的外设输入输出接口,输出高电平和低电平,输入高电平和低电平

firefly_rk3399_gpio

门电路:与门 或门 非门

协议类

UART、I2C、SPI、TFT LCD

EDP接口

firefly_rk3399_cpu_edp

firefly_rk3399_edp

类似内存的接口

比如:Nor Flash、SDRAM、DDR、网卡DM9000, 很多设备也采用类似内存的接口,比如Nor Flash、8080接口的LCD

内存:可以读写某个地址上的数据,所以必定有这些信号

  • 地址总线
  • 数据总线
  • 读/写信号
  • 片选(cs):ram-like接口上可以接多个设备,互相之间不能干扰,选中哪个设备哪个设备才能响应

ddr3_csdn

RK3399 Firefly

firefly_rk3399_ddr3

屏幕调节

  • 屏幕使能: LCD_EN
  • 屏幕RESET:LCD_RST
  • 背光使能:BL_EN
  • PWM:BL_PWM

PWM

Firefly-RK3399 开发板上有 4 路 PWM 输出,分别为PWM0 ~ PWM3,4路 PWM 分别使用在 EDP 背光、MIPI 背光、VDDLOG 供电、红外 IR。

kernel/arch/arm64/boot/dts/rockchip/rk3399.dtsi


               pwm0 {
                        pwm0_pin: pwm0-pin {
                                rockchip,pins =
                                        <4 18 RK_FUNC_1 &pcfg_pull_none>;  //PWM
                        };

                        vop0_pwm_pin: vop0-pwm-pin {
                                rockchip,pins =
                                        <4 18 RK_FUNC_2 &pcfg_pull_none>;
                        };

                        vop1_pwm_pin: vop1-pwm-pin {
                                rockchip,pins =
                                        <4 18 RK_FUNC_3 &pcfg_pull_none>;
                        };
                };

                pwm1 {
                        pwm1_pin: pwm1-pin {
                                rockchip,pins =
                                        <4 22 RK_FUNC_1 &pcfg_pull_none>;
                        };
                };

                pwm2 {
                        pwm2_pin: pwm2-pin {
                                rockchip,pins =
                                        <1 19 RK_FUNC_1 &pcfg_pull_none>;
                        };
                };

                pwm3a {
                        pwm3a_pin: pwm3a-pin {
                                rockchip,pins =
                                        <0 6 RK_FUNC_1 &pcfg_pull_none>;
                        };
                };

                pwm3b {
                        pwm3b_pin: pwm3b-pin {
                                rockchip,pins =
                                        <1 14 RK_FUNC_1 &pcfg_pull_none>;
                        };
                };

背光使能 BL_EN

kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-edp.dts


       edp_panel: edp-panel {
                compatible = "simple-panel";
                status = "okay";

                backlight = <&backlight>;
                display-timings {
                    native-mode = <&timing0>;

                    timing0: timing0 {
                        clock-frequency = <200000000>;
                        hactive = <1536>;
                        vactive = <2048>;
                        hfront-porch = <12>;
                        hsync-len = <16>;
                        hback-porch = <48>;
                        vfront-porch = <8>;
                        vsync-len = <4>;
                        vback-porch = <8>;
                        hsync-active = <0>;
                        vsync-active = <0>;
                        de-active = <0>;
                        pixelclk-active = <0>;
                    };
                };

                ports {
                        panel_in_edp: endpoint {
                                remote-endpoint = <&edp_out_panel>;
                        };
                };

                power_ctr: power_ctr {
                        rockchip,debug = <0>;
                        lcd_en: lcd-en {
                                        gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; //屏幕使能引脚
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&lcd_panel_enable>;
                                        rockchip,delay = <20>;
                        };
                        lcd_rst: lcd-rst {
                                        gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&lcd_panel_reset>;
                                        rockchip,delay = <20>;
                        };
                };
        };


        backlight: backlight {
                compatible = "pwm-backlight";
                pwms = <&pwm0 0 25000 0>;
                brightness-levels = <
                          0   1   2   3   4   5   6   7
                          8   9  10  11  12  13  14  15
                         16  17  18  19  20  21  22  23
                         24  25  26  27  28  29  30  31
                         32  33  34  35  36  37  38  39
                         40  41  42  43  44  45  46  47
                         48  49  50  51  52  53  54  55
                         56  57  58  59  60  61  62  63
                         64  65  66  67  68  69  70  71
                         72  73  74  75  76  77  78  79
                         80  81  82  83  84  85  86  87
                         88  89  90  91  92  93  94  95
                         96  97  98  99 100 101 102 103
                        104 105 106 107 108 109 110 111
                        112 113 114 115 116 117 118 119
                        120 121 122 123 124 125 126 127
                        128 129 130 131 132 133 134 135
                        136 137 138 139 140 141 142 143
                        144 145 146 147 148 149 150 151
                        152 153 154 155 156 157 158 159
                        160 161 162 163 164 165 166 167
                        168 169 170 171 172 173 174 175
                        176 177 178 179 180 181 182 183
                        184 185 186 187 188 189 190 191
                        192 193 194 195 196 197 198 199
                        200 201 202 203 204 205 206 207
                        208 209 210 211 212 213 214 215
                        216 217 218 219 220 221 222 223
                        224 225 226 227 228 229 230 231
                        232 233 234 235 236 237 238 239
                        240 241 242 243 244 245 246 247
                        248 249 250 251 252 253 254 255>;
                default-brightness-level = <200>;
        };