orange pi 5 plus开发板使用

系统镜像烧写

参考网址: http://www.orangepi.cn/orangepiwiki/index.php/Orange_Pi_5_Plus

  • 烧写方法: 使用RKDevTool烧录Linux镜像到eMMC中的方法
  • 烧写镜像: 选择Orangepi5plus_1.0.6_ubuntu_jammy_desktop_gnome_linux5.10.110.img
  • 驱动: DriverAssitant_v5.12
  • 烧写工具: RKDevTool_Release_v3.15
  • boot文件和烧写配置文件: MiniLoader

烧写镜像

  1. 准备驱动、烧写工具、烧写镜像、boot文件和烧写配置文件,在官网下载即可

  2. 先不连接电源,将Type-C线连接好PC和开发板,将emmc模块安装好,emmc安装参考官方示意图(ps: emmc安装时候一定要听到卡住的声音不然就是没有安装好)

  3. 安装驱动

  4. 打开烧写工具,这时候按住开发板的maskrom按钮,按住不放的同时再讲开发板电源插好,烧写工具底部出现发现一个MASKROM设备,则说明进入了烧写模式

  5. 在烧写工具中导入配置rk3588_linux_emmc.cfg,将boot文件和镜像文件选中,再勾选强制按地址写,点击执行按钮

  6. 等待最后烧写完成,如果开发板没有自动重启(看烧写工具还在显示发现一个MASKROM设备),大概率需要清空SPIFlash,清空SPIFlash就继续一下

  7. 将开发板断电,按住maskrom按钮再连接电源,点击烧写工具的高级功能,下载boot文件,选择SPINOR点击切换存储,再选择擦除所有,最后断电,再把烧写线断开。

设备频率设置

  • cpu(小核0-3)
sudo -s
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies #查看cpu 可设置的频率
cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq # 查看当前频率
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq # 查看当前最大频率
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors # 查看当前可设置的模式
echo 1800000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq # 设置最高频率
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor #设置性能模式 并按最高频率锁频

  • cpu(大核4-5)
cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies #查看cpu 可设置的频率
cat /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq # 查看当前频率
echo 2400000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq # 设置最高频率
echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor #设置性能模式 并按最高频率锁频
  • cpu(大核6-7)
cat /sys/devices/system/cpu/cpufreq/policy6/scaling_available_frequencies #查看cpu 可设置的频率
cat /sys/devices/system/cpu/cpufreq/policy6/cpuinfo_cur_freq # 查看当前频率
echo 2400000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_max_freq # 设置最高频率
echo performance > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor #设置性能模式 并按最高频率锁频
  • gpu
cat /sys/class/devfreq/fb000000.gpu/available_frequencies # 查看可设置的频率
cat /sys/class/devfreq/fb000000.gpu/available_governors # 查看当前可设置的模式
echo 1000000000 > /sys/class/devfreq/fb000000.gpu/max_freq # 设置最大频率
echo performance > /sys/class/devfreq/fb000000.gpu/governor # 设置性能模式并按最高频率锁频
  • npu
cat /sys/class/devfreq/fdab0000.npu/available_frequencies # 查看可设置的频率
cat /sys/class/devfreq/fdab0000.npu/available_governors # 查看当前可设置的模式
echo 1000000000 > /sys/class/devfreq/fdab0000.npu/max_freq # 设置最大频率
echo performance > /sys/class/devfreq/fdab0000.npu/governor # 设置性能模式并按最高频率锁频

cpu频率设置(采用 cpufreq-set 命令)

cpufreq-info # 查看 cpu频率信息
cpufreq-set -c 0 -u 1.80GHZ
cpufreq-set -c 6 -u 2.40GHZ

设置性能模式的开机自启动脚本 performance.sh如下:

#!/bin/sh

### BEGIN INIT INFO
# Provides:          XXX
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start XXX daemon at boot time
# Description:       Start XXX daemon at boot time
### END INIT INFO

echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq  # 因为权限问题需要修改该文件权限 ,root的密码是 1
echo "1" | sudo -S echo 1800000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo "1" | sudo -S echo 1800000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq # 修改最大频率
echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo "1" | sudo -S echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor #设置性能模式 并按最高频率锁频
echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
echo "1" | sudo -S echo 2400000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
echo "1" | sudo -S echo 2400000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
echo "1" | sudo -S echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy6/scaling_max_freq
echo "1" | sudo -S echo 2400000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
echo "1" | sudo -S echo 2400000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_max_freq
echo "1" | sudo -S chmod 666 /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo "1" | sudo -S echo performance > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo "1" | sudo -S chmod 666 /sys/class/devfreq/fdab0000.npu/max_freq
echo "1" | sudo -S echo 1000000000 > /sys/class/devfreq/fdab0000.npu/min_freq
echo "1" | sudo -S echo 1000000000 > /sys/class/devfreq/fdab0000.npu/max_freq
echo "1" | sudo -S chmod 666 /sys/class/devfreq/fdab0000.npu/governor
echo "1" | sudo -S echo performance > /sys/class/devfreq/fdab0000.npu/governor

之后拷贝到系统环境中

chmod +x performance.sh
sudo cp performance.sh /etc/init.d/

配置开机自启脚本

参考链接: https://zhuanlan.zhihu.com/p/523973210
在 /usr/lib/systemd/system/ 下创建文件 performance.service,文件内容如下所示:

[Unit]
Description=Performance: Set Performance Mode
SourcePath=/etc/init.d/performance.sh
Description=LSB: Start XXX daemon at boot time
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target

[Service]
Type=forking
ExecStart=sh /etc/init.d/performance.sh
ExecReload=sh /etc/init.d/performance.sh
PrivateTmp=True

[Install]
WantedBy=multi-user.target

之后在终端下执行:

sudo systemctl enable performance.service

温度监控

参考链接: https://blog.csdn.net/weixin_43245753/article/details/124341281

  • 查看npu温度
watch -n 5 cat /sys/class/thermal/thermal_zone6/temp
  • 查看芯片中心温度
watch -n 5 cat /sys/class/thermal/thermal_zone0/temp

查看gpu 占用

sudo -s
watch -n 1 cat /sys/class/devfreq/fb000000.gpu/load

查看npu 占用

sudo -s
watch -n 1 cat /sys/kernel/debug/rknpu/load

性能优化

参考: https://blog.csdn.net/weixin_43245753/article/details/127502360
参考: https://github.com/mfkiwl/rk-open-docs/blob/master/DVFS/Rockchip_Developer_Guide_CPUFreq_CN.md

su # 切换root用户
cat /sys/kernel/debug/regulator/regulator_summary #查看电压信息获取最大电压

# 锁频
echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 1800000  > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
echo userspace > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
echo 2400000  > /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed
echo userspace > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 2400000  > /sys/devices/system/cpu/cpufreq/policy6/scaling_setspeed
echo userspace > /sys/class/devfreq/fdab0000.npu/governor
echo 1000000000 > /sys/class/devfreq/fdab0000.npu/userspace/set_freq
echo 8 >  /proc/sys/kernel/sched_pelt_period # 设置CPU负载采样时间
# 设置 cpu、npu、ddr 的电压
echo 1050000 > /sys/kernel/debug/regulator/vdd_cpu_big0_s0/voltage
echo 1050000 > /sys/kernel/debug/regulator/vdd_cpu_big1_s0/voltage
echo 950000 > /sys/kernel/debug/regulator/vdd_npu_s0/voltage
echo 950000 > /sys/kernel/debug/regulator/vdd_cpu_lit_s0/voltage
echo 900000 > /sys/kernel/debug/regulator/vdd_ddr_s0/voltage
posted @ 2023-08-15 17:59  cc96  阅读(1014)  评论(0编辑  收藏  举报