• 3288读取cpu温度失败问题 M


    RK3288使用TSADC(Temperature-Sensor ADC)来测量CPU温度,支持两种模式:
    用户自定义模式: 主动控制读取温度.
    自动模式: 自动检测温度,达到阀值就自动报告.

    dts配置如下:

    &tsadc {
    rockchip,hw-tshut-mode = <0>; /* tshut mode 0:CRU 1:GPIO */
    rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
    status = "okay";
    };
    
    tsadc: tsadc@ff280000 {
    compatible = "rockchip,rk3288-tsadc";
    reg = <0x0 0xff280000 0x0 0x100>;
    interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
    clock-names = "tsadc", "apb_pclk";
    assigned-clocks = <&cru SCLK_TSADC>;
    assigned-clock-rates = <5000>;
    resets = <&cru SRST_TSADC>;
    reset-names = "tsadc-apb";
    pinctrl-names = "init", "default", "sleep";
    pinctrl-0 = <&otp_gpio>;
    pinctrl-1 = <&otp_out>;
    pinctrl-2 = <&otp_gpio>;
    #thermal-sensor-cells = <1>;
    rockchip,hw-tshut-temp = <95000>;
    status = "disabled";
    };

    用指令读取CPU温度:cat sys/class/thermal/thermal_zone0/temp,会报错/system/bin/sh: cat: temp: Invalid argumen。

    看开机log,发现有如下报错:

    clk: couldn't get clock 0 for /tsadc@ff280000

    说明tsadc缺少clock,查看dts,确实是少了这块。

    xin32k: xin32k {
        compatible = "fixed-clock";
        clock-frequency = <32768>;
        clock-output-names = "xin32k";
        #clock-cells = <0>;
    };

    以为这个时钟加上就好了,令人抓狂的是,就加了这么几行代码,机器竟然一直重启开不起机了。

    加的这个地方是跟温度是相关的,那就从这个方面入手去思考找问题。会不会是检测到温度的过温阀值,导致重启的呢?

    看硬件的连接上:

    主控的OTP 引脚是有连接出来到pmic rk808的,如果这个阀值到了reset脚就会动作,然后重启。

    由于没有硬性需求一定要这个温度到了阀值就重启的需求,这个时候可以把硬件上的连接电阻去掉,或者软件上把reset的io屏蔽掉。实际起作用的是:

    pinctrl-1 = <&otp_out>;
    屏蔽掉,这时候机器就可以正常开机了。

    再查看温度值:cat sys/class/thermal/thermal_zone0/temp
    54111

    就能正常读到温度值了。

    不过不太能理解的是,配置里 rockchip,hw-tshut-temp = <95000>;是超过95度才重启,一开机应该也不会超过阀值才对,开机后读取的温度也就50°C。

  • 相关阅读:
    Struts2+Spring3+Mybatis3开发环境搭建
    spring+struts2+mybatis
    【LeetCode】Populating Next Right Pointers in Each Node
    【LeetCode】Remove Duplicates from Sorted Array
    【LeetCode】Remove Duplicates from Sorted Array II
    【LeetCode】Binary Tree Inorder Traversal
    【LeetCode】Merge Two Sorted Lists
    【LeetCode】Reverse Integer
    【LeetCode】Same Tree
    【LeetCode】Maximum Depth of Binary Tree
  • 原文地址:https://www.cnblogs.com/wmc245376374/p/15579044.html
Copyright © 2020-2023  润新知