2025年5月10日星期六

RK3399PRO 双LVDS 驱动1080P面板记录

 











面板是LG的 LD5500EUE 不管怎么调节 都是只有一多半的屏幕显示,而且关掉uboot LOGO后就黑屏了,什么都不显示了。


跑去官方论坛发了个帖询问,下午继续研究初始化序列,


果然还是初始化序列的原因,仔细核对面板datasheet时序参数,修改dts里的

二进制初始化序列,完美全屏点亮。


/*

 * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd

 *

 * This file is dual-licensed: you can use it either under the terms

 * of the GPL or the X11 license, at your option. Note that this dual

 * licensing only applies to this file, and not this project as a

 * whole.

 *

 *  a) This file is free software; you can redistribute it and/or

 *     modify it under the terms of the GNU General Public License as

 *     published by the Free Software Foundation; either version 2 of the

 *     License, or (at your option) any later version.

 *

 *     This file is distributed in the hope that it will be useful,

 *     but WITHOUT ANY WARRANTY; without even the implied warranty of

 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

 *     GNU General Public License for more details.

 *

 * Or, alternatively,

 *

 *  b) Permission is hereby granted, free of charge, to any person

 *     obtaining a copy of this software and associated documentation

 *     files (the "Software"), to deal in the Software without

 *     restriction, including without limitation the rights to use,

 *     copy, modify, merge, publish, distribute, sublicense, and/or

 *     sell copies of the Software, and to permit persons to whom the

 *     Software is furnished to do so, subject to the following

 *     conditions:

 *

 *     The above copyright notice and this permission notice shall be

 *     included in all copies or substantial portions of the Software.

 *

 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES

 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT

 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,

 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

 *     OTHER DEALINGS IN THE SOFTWARE.

 */


/dts-v1/;

#include "rk3399pro-firefly-port.dtsi"


/ {

        model = "RK3399pro-firefly-aiojd4 board 10.1 lvds (Android)";

        compatible = "rockchip,rk3399pro-firefly-aiojd4-lvds", "rockchip,rk3399pro";


};


&backlight {

                status = "okay";

                pwms = <&pwm0 0 25000 1>;

                brightness-levels = <

                         /*0 20  20  21  21  22  22  23

                         23  24  24  25  25  26  26  27

                         27  28  28  29  29  30  30  31

                         31  32  32  33  33  34  34  35

                         35  36  36  37  37  38  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>;

                enable-gpios = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>;

};


&dsi {

        status = "okay";

        panel@0 {

                compatible ="simple-panel-dsi";

                reg = <0>;

                rockchip,lane-rate = <862>;

                backlight = <&backlight>;


                enable-5v-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; //vcc_5v_en

                enable-tc-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; //tc358775 power

                reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; //tc358775 reset



                dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;

                dsi,format = <MIPI_DSI_FMT_RGB888>;

                //bus-format = <MEDIA_BUS_FMT_RGB666_1X18>;

                                bus-format = <MEDIA_BUS_FMT_RGB888_1X24>;

                dsi,lvds-force-clk = <800>; // 800/2/3 ~= 65Mhz

                dsi,lanes = <4>;


        dsi,channel = <0>;


        enable-delay-ms = <35>;

        prepare-delay-ms = <6>;


        unprepare-delay-ms = <0>;

        disable-delay-ms = <20>;


        size,width = <120>;

        size,height = <170>;

        status = "okay";

         panel-init-sequence = [

                        29 00 06 14 01 08 00 00 00

                        29 00 06 3c 01 0c 00 0a 00

                        29 00 06 64 01 0c 00 00 00

                        29 00 06 68 01 0c 00 00 00

                        29 00 06 6c 01 0c 00 00 00

                        29 00 06 70 01 0c 00 00 00

                        29 00 06 34 01 1f 00 00 00

                        29 00 06 10 02 1f 00 00 00

                        29 00 06 04 01 01 00 00 00

                        29 00 06 04 02 01 00 00 00

                        29 00 06 50 04 00 01 f0 03

                        29 00 06 54 04 14 00 64 00

                        29 00 06 58 04 80 07 a0 00

                        29 00 06 5c 04 0a 00 19 00

                        29 00 06 60 04 38 04 0a 00

                        29 00 06 64 04 01 00 00 00

                        29 00 06 a0 04 06 c0 00 00

                        29 00 06 04 05 04 00 00 00

                        29 00 06 80 04 00 01 02 03

                        29 00 06 84 04 04 07 05 08

                        29 00 06 88 04 09 0a 0e 0f

                        29 00 06 8c 04 0b 0c 0d 10

                        29 00 06 90 04 16 17 11 12

                        29 00 06 94 04 13 14 15 1b

                        29 14 06 98 04 18 19 1a 06

                        29 78 06 9c 04 33 04 00 00       

                ];       


                panel-exit-sequence = [

                        05 05 01 28

                        05 78 01 10

                ];


                display-timings {

                                          native-mode = <&timing0>;

                                           timing0: timing0 {

                                //32 inch screen

                                clock-frequency = <123750000>;

                                                                

                                hactive = <1920>;

                                vactive = <1080>;


                                hback-porch = <100>;

                                hsync-len = <20>;

                                hfront-porch = <160>;

                                vback-porch = <25>;

                                vfront-porch = <10>;

                                vsync-len = <10>;

                                hsync-active = <0>;

                                vsync-active = <0>;

                                de-active = <0>;

                                pixelclk-active = <0>;

                        };

                                      };

                };

};


&route_dsi {

        status = "okay";

        logo,mode = "center";

        charge_logo,mode = "center";

        logo,uboot = "logo.bmp";

        logo,kernel = "logo_kernel.bmp";

        connect = <&vopb_out_dsi>;

};


&route_hdmi {

        status = "okay";

        logo,mode = "center";

};


//ubbot fb dsi0

&vopb_out_dsi {

        status = "okay";

};

&vopl_out_dsi {

        status = "disabled";

};


&dsi_in_vopl {

    status = "disabled";

};


&dsi_in_vopb {

    status = "okay";

};



&pwm0 {

        status = "okay";

};


&hdmi {

    status = "okay";

        rockchip,phy-table =

        <74250000  0x8009 0x0004 0x0272>,

        <165000000 0x802b 0x0004 0x0209>,

        <297000000 0x8039 0x0005 0x028d>,

        <594000000 0x8039 0x0000 0x00f6>,

        <000000000 0x0000 0x0000 0x0000>;

};


&hdmi_dp_sound {

        status = "okay";

};


&hdmi_in_vopb {

        status = "disabled";

};


&hdmi_in_vopl {

    status = "okay";

};


&dp_in_vopb {

        status = "disabled";

};


&vopb {

    assigned-clocks = <&cru DCLK_VOP0_DIV>;

    assigned-clock-parents = <&cru PLL_CPLL>;

};


&vopl {

    assigned-clocks = <&cru DCLK_VOP1_DIV>;

    assigned-clock-parents = <&cru PLL_VPLL>;

};


&i2c4 {                                                                                                                                                                 

    status = "okay";

    i2c-scl-rising-time-ns = <345>;

    i2c-scl-falling-time-ns = <11>;


    gslx680: gslx680@41 {

        status = "okay";

        compatible = "gslX680";

        reg = <0x41>;

        screen_max_x = <800>;

        screen_max_y = <1280>;

        touch-gpio = <&gpio4 RK_PD5 IRQ_TYPE_LEVEL_LOW>;

        reset-gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>;

        flip-x = <1>;

        flip-y = <0>;

        swap-xy = <0>;

        gsl,fw = <1>;

        };

};





nRFgo识别不出,但是mdk能识别出设备的解决方法

 遇到一个JLINKV9.2 固件提示最新版本,


mdk能正常发现和擦写设备,但是nRFgo却识别不出我的nrf52832


很奇怪,换一个jlinkv8 nrfgo识别出了,说明是这个jlink v9.2的问题,


后来网上找了旧版jlink固件,重刷jlink v9固件搞定,


貌似某宝的一批jlinkv9.2都有这个问题,记录一下吧

TJA1050只能RX不能TX



今天新换的TJA1050发现只能RX不能TX,芯片上面有个小圆点角标

换回旧的TJA1050没有角标的芯片,一切正常

所以推测市面上带角标的一批TJA1050是假货。

仅供大家参考

Android8添加开机Service 必须添加相应的te文件



selinux的原因,添加Service必须添加.te文件

(即使是permissive)也要添加.te文件

否则seclabel会出错。

firefly 的 rk3399pro Android8.1


.te文件放在device/rockchip/common/sepolicy/下面


.te文件内容

type autorun,domain;
type autorun_exec,exec_type,file_type;
permissive autorun;


init.rk30board.rc内容:

# autorun
service autorun /system/bin/auto_run.sh
seclabel u:r:autorun:s0
user root
group root
disabled
oneshot

on property:persist.sys.auto_run=0
stop autorun

on property:persist.sys.auto_run=1
start autorun

firelfy rk3399pro默认开启adb模式

串口或者ADB执行命令


setprop persist.usb.mode peripheral

reboot

验证


重启后发现

getprop persist.usb.mode


值为peripheral,这样USB就变成ADB模式了


源码里修改的方法 找到对应的mk文件,修改persist.usb.mode默认值为peripheral就可以了


FIREFLY RK3399PRO NVME速度测试

 SSD 128G的NVME 品牌为忆联


板子firefly的rk3399pro

root@firefly:/nvmedir# 

root@firefly:/nvmedir# dd if=/dev/zero of=./test bs=200MB count=10

10+0 records in

10+0 records out

2000000000 bytes (2.0 GB, 1.9 GiB) copied, 5.5693 s, 359 MB/s

root@firefly:/nvmedir# 

root@firefly:/nvmedir# 


root@firefly:/nvmedir# dd if=./test of=/dev/zero bs=200MB count=9

9+0 records in

9+0 records out

1800000000 bytes (1.8 GB, 1.7 GiB) copied, 4.36823 s, 412 MB/s

root@firefly:/nvmedir# 


root@firefly:/nvmedir# 

root@firefly:/nvmedir# df -lh

Filesystem      Size  Used Avail Use% Mounted on

/dev/root        15G  2.7G   12G  20% /

devtmpfs        978M     0  978M   0% /dev

tmpfs           979M     0  979M   0% /dev/shm

tmpfs           979M   17M  962M   2% /run

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs           979M     0  979M   0% /sys/fs/cgroup

tmpfs           196M     0  196M   0% /run/user/0

tmpfs           196M   16K  196M   1% /run/user/1000

/dev/nvme0n1p1  117G  2.0G  109G   2% /nvmedir

root@firefly:/nvmedir# 


总结 

连续读1.8GB的数据,速度为412MB/s

连续写2GB的数据,速度为359MB/s

________________________________________________________________

ROHM的EEPROM SPI读写编程



型号为 BR93L56-W SPI接口 4线连接,这里使用GPIO模拟SPI操作。

首先研究Timing















然后是代码:

void SPI_Init(void)
{
    SPI_SCK_0;
    SPI_CS_0;
    SPI_MOSI_0;
}

void EEPROM_SendADDR(uint8_t send_addr)
{
    uint8_t i;

    for(i = 0;i<8;i++)
    {
        if(send_addr & 0x80)
        {
               SPI_MOSI_1;
        }
    else
    {
            SPI_MOSI_0;
    }
    send_addr<<=1;
    delay_us(500);
    SPI_SCK_1;
    delay_us(500);
    SPI_SCK_0;
    }
}

uint16_t EEPROM_Receive(void)
{
    uint16_t receive_data = 0;
    uint8_t i;

    for(i=0;i<16;i++)
    {
        SPI_SCK_1;
        delay_us(500);
        receive_data<<=1;
        if(SPI_READ_MISO)
        {
            receive_data ++;
        }
        SPI_SCK_0;
        delay_us(500);

    }
    return receive_data;
}


uint16_t EEPROM_Read(uint8_t read_addr)
{
    uint16_t read_data;
    uint8_t i;
    uint8_t read_code = 0x06;
    SPI_MOSI_0;
    SPI_CS_1;
    for(i = 0;i<4;i++)
    {
        if(read_code & 0x08)
        {
            SPI_MOSI_1;
        }
        else
        {
            SPI_MOSI_0;
        }
    read_code<<=1;
    delay_us(500);
    SPI_SCK_1;
    delay_us(500);
    SPI_SCK_0;
    }

    EEPROM_SendADDR(read_addr);

    read_data = EEPROM_Receive();
    SPI_CS_0;
    return read_data;
}

void EEPROM_SendDATA(uint16_t send_data)
{
    int i;

    for(i = 0;i<16;i++)
    {
        if(send_data & 0x8000)
        {
            SPI_MOSI_1;
        }
        else
        {
            SPI_MOSI_0;
        }
        send_data<<=1;
        delay_us(500);
        SPI_SCK_1;
        delay_us(500);
        SPI_SCK_0;
    }
}


void EEPROM_WEN(void)
{
SPI_MOSI_0;
SPI_CS_1;
uint8_t i;
uint8_t wen_code = 0x13;
for(i = 0;i<6;i++)
{
if(wen_code & 0x20)
{
SPI_MOSI_1;
}
else
{
SPI_MOSI_0;
}
wen_code<<=1;
delay_us(500);
SPI_SCK_1;
delay_us(500);
SPI_SCK_0;
}
wen_code = 0x01;
for(i = 0;i<6;i++)
{
if(wen_code & 0x20)
{
SPI_MOSI_1;
}
else
{
SPI_MOSI_0;
}
wen_code<<=1;
delay_us(500);
SPI_SCK_1;
delay_us(500);
SPI_SCK_0;
}
SPI_CS_0;
}


void EEPROM_Write(uint8_t write_addr,uint16_t write_data)
{
uint8_t i;
uint8_t write_code = 0x05;
EEPROM_WEN();
SPI_MOSI_0;
SPI_CS_1;
for(i = 0;i<4;i++)
{
if(write_code & 0x8)
{
SPI_MOSI_1;
}
else
{
SPI_MOSI_0;
}
write_code<<=1;
delay_us(500);
SPI_SCK_1;
delay_us(500);
SPI_SCK_0;
}
EEPROM_SendADDR(write_addr);
EEPROM_SendDATA(write_data);
SPI_CS_0;
delay_ms(6);
}


最后读写测试OK


几个注意点,主要还是得仔细看手册。


1 此EEPROM CS高电平有效


2 此EEPROM 时钟频率最快支持 2MHz clock,所以SCK延迟不能太小,频率计算要在2MHZ以下


3 此EEPROM SPI发送和接收数据 一次16bit,地址是8bit


4 Write enable (WEN)时,第6个SCK后的时钟也必须输入,也就是10011后的6-11个SCK不能忽略,数据可以任意


2025年5月9日星期五

记录一次手动更新英特尔 Management Engine 固件的经历

笔记本电脑是Thinkpad X1c gen11

System Update推送了好几次BIOS和ME,BIOS每次都可以更新成功,ME每次都失败。

表现为安装ME更新包后提示3秒后重启,重启后查看设备管理器的 Intel Management Engine

Interface的固件版本,依然是16.1.25.2124,从联想System Update推送下来的更新包是16.1.35.2557。

无论更新多少次,依旧是16.1.25.2124。


后来研究了下更新包里的脚本,打算手动更新。

1   安装好Intel_R_ME_SW_2512.7.13.0

2    n3xrg03w.exe 运行选择仅解压

3    控制面板\系统和安全\BitLocker 驱动器加密,备份C盘的恢复密钥
(非常重要)

4    暂时关闭BitLocker

       manage-bde -protectors -disable C:  

5    运行 MEInfoWin64.exe ,读取OEM ID 和 Current sku type

C:\DRIVERS\WIN\ME\20250405.11313648\misc\Non_Capsule> .\MEInfoWin64.exe

6    MEInfoWin64.exe读到的信息,重点关注2个字段
      --1  Firmware Update OEM ID  的值记录下来
      --2  Current sku type  的值
            如果是 Consumer 说明(ME 固件为消费级别)
            如果是 Corporate 说明(ME 固件为企业级别)
            消费者版固件:ME_16.0_Cons.BIN
            企业版固件:   ME_16.0_Corp.BIN
            我的机器读取到的是Consumer ,所以需要刷入的固件是 ME_16.0_Cons.BIN

7   运行固件更新命令 

     XXXXXXXX-XXXX-0000-0000-000000000000 替换成刚刚读取到的 OEM ID

FWUpdLcl64.exe -F "C:\DRIVERS\WIN\ME\20250405.11313648\misc\Non_Capsule\ME_16.0_Cons.BIN" -Y -OEMID XXXXXXXX-XXXX-0000-0000-000000000000 

8    更新进度出现了,100%后重启电脑

9    启动界面输入刚刚备份好的恢复密钥解锁驱动器。

10  进系统查看设备管理器的 Intel Management Engine Interface的固件版本号,成功更新为16.1.35.2557。

 

从联想服务器获取到的ME更新程序:

Thinkpad-X1c-Gen11-ME-16.1.35.2557 

 

 

 

 

XG-040G-XX SuPassword 解密工具

 买了新光猫 XG-040G-TF ,  所以写了一个 SuPassword 解密工具, 以备不时之需 . 点击下载