1、系统不带电池开机不断重启
现象:
在执行reboot或第一次烧录之后开机时大概率出现:
set root to /dev/nand0p4
reading ULI/factory/mac.txt
FAT: Misaligned buffer address (4ac89eb8)
no misc partition is found
set next system normal
NAND_UbootExit
NB1 : N[684]
原因:
主要原因是系统不带电池,而全志平台默认是带电池的,系统开机一直在找电池,没找到就不断重启
解决:
在sys_config.fex文件中添加:
pmu_bat_unused = 1
2、全志平台打开所有日志输出
t7\lichee\tools\pack\chips\sun8iw17p1\configs\default\env.cfg
#kernel command arguments
earlyprintk=sunxi-uart,0x05000000
initcall_debug=0
console=ttyS0,115200
nand_root=/dev/nandd
mmc_root=/dev/mmcblk0p7
init=/init
loglevel=3 ####这里修改成8将打开全部日志输出
rtc_disable=0
cma=32M
vmalloc=384M
#carvout=252M
carvout=0x54000000,0xFC00000
#set kernel cmdline if boot.img or recovery.img has no cmdline we will use this
setargs_nand=setenv bootargs earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} rtc_disable=${rtc_disable} root=${nand_root} init=${init} partitions=${partitions} cma=${cma} vmalloc=${vmalloc} carvout=${carvout}
setargs_mmc=setenv bootargs earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} rtc_disable=${rtc_disable} root=${mmc_root} init=${init} partitions=${partitions} cma=${cma} vmalloc=${vmalloc} carvout=${carvout}
#nand command syntax: sunxi_flash read address partition_name read_bytes
#0x4007f800 = 0x40080000(kernel entry) - 0x800(boot.img header 2k)
boot_normal=sunxi_flash read 45000000 boot;boota 45000000 boot
boot_recovery=sunxi_flash read 45000000 recovery;boota 45000000 recovery
boot_fastboot=fastboot
#recovery key
recovery_key_value_max=0x13
recovery_key_value_min=0x10
#fastboot key
fastboot_key_value_max=0x8
fastboot_key_value_min=0x2
#uboot system env config
bootdelay=0 ####boot开机延迟
#default bootcmd, will change at runtime according to key press
bootcmd=run setargs_nand boot_normal#default nand boot
3、FAQ_全志平台Tina3.0.7 RXXX cowbell方案启动时cpufreq报错且无法生成cpufreq节点
【软件版本】Tina 3.0.7 cowbell方案
启动时报错:
[ 3.434693] sunxi_cpufreq_init: only one opp_table
[ 3.440182] [cpu_freq] ERR: DEBUG: get cpu 0 device
[ 3.445719] [cpu_freq] ERR: Unable to get regulator
[ 3.451307] ------------[ cut here ]------------
[ 3.456530] WARNING: CPU: 0 PID: 1 at drivers/base/power/opp/of.c:357 _of_add_opp_table_v2+0x94/0x3b4
[ 3.466908] Modules linked in:
[ 3.470360] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.118 #1
[ 3.477110] Hardware name: sun8iw18
[ 3.481054] [<c0016ac0>] (unwind_backtrace) from [<c0012df0>] (show_stack+0x10/0x14)
[ 3.489770] [<c0012df0>] (show_stack) from [<c01bb2e8>] (dump_stack+0x7c/0x98)
[ 3.497902] [<c01bb2e8>] (dump_stack) from [<c001f9a8>] (__warn+0xd8/0xf8)
[ 3.505638] [<c001f9a8>] (__warn) from [<c001fa6c>] (warn_slowpath_null+0x1c/0x24)
[ 3.514156] [<c001fa6c>] (warn_slowpath_null) from [<c02313e4>] (_of_add_opp_table_v2+0x94/0x3b4)
[ 3.524142] [<c02313e4>] (_of_add_opp_table_v2) from [<c0231bac>] (dev_pm_opp_of_cpumask_add_table_by_soc_bin+0x80/0xc0)
[ 3.536378] [<c0231bac>] (dev_pm_opp_of_cpumask_add_table_by_soc_bin) from [<c030847c>] (sunxi_cpufreq_init+0x154/0x3bc)
[ 3.548616] [<c030847c>] (sunxi_cpufreq_init) from [<c0304ca4>] (cpufreq_online+0x160/0x604)
[ 3.558112] [<c0304ca4>] (cpufreq_online) from [<c03051ac>] (cpufreq_add_dev+0x54/0x7c)
[ 3.567121] [<c03051ac>] (cpufreq_add_dev) from [<c022148c>] (subsys_interface_register+0xbc/0xc8)
[ 3.577204] [<c022148c>] (subsys_interface_register) from [<c030421c>] (cpufreq_register_driver+0x114/0x1f0)
[ 3.588266] [<c030421c>] (cpufreq_register_driver) from [<c0635c94>] (sunxi_cpufreq_initcall+0x20/0x44)
[ 3.598836] [<c0635c94>] (sunxi_cpufreq_initcall) from [<c0009b00>] (do_one_initcall+0x140/0x174)
[ 3.608822] [<c0009b00>] (do_one_initcall) from [<c061ade4>] (kernel_init_freeable+0x18c/0x1d4)
[ 3.618613] [<c061ade4>] (kernel_init_freeable) from [<c04c4840>] (kernel_init+0x8/0xec)
[ 3.627719] [<c04c4840>] (kernel_init) from [<c000edf0>] (ret_from_fork+0x14/0x24)
[ 3.636285] ---[ end trace 242be0e306f7b58c ]---
[ 3.641493] of: dev_pm_opp_of_cpumask_add_table_by_soc_bin: couldn't find opp table for cpu:0, -2
[ 3.651527] [cpu_freq] ERR: Failed to add opp table
[ 3.657192] sunxi_cpufreq_init: only one opp_table
[ 3.662601] [cpu_freq] ERR: DEBUG: get cpu 1 device
[ 3.668118] [cpu_freq] ERR: Unable to get regulator
[ 3.673677] ------------[ cut here ]------------
[ 3.678888] WARNING: CPU: 1 PID: 1 at drivers/base/power/opp/of.c:357 _of_add_opp_table_v2+0x94/0x3b4
[ 3.689264] Modules linked in:
[ 3.692715] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.9.118 #1
[ 3.700832] Hardware name: sun8iw18
[ 3.704766] [<c0016ac0>] (unwind_backtrace) from [<c0012df0>] (show_stack+0x10/0x14)
[ 3.713484] [<c0012df0>] (show_stack) from [<c01bb2e8>] (dump_stack+0x7c/0x98)
[ 3.721614] [<c01bb2e8>] (dump_stack) from [<c001f9a8>] (__warn+0xd8/0xf8)
[ 3.729350] [<c001f9a8>] (__warn) from [<c001fa6c>] (warn_slowpath_null+0x1c/0x24)
[ 3.737869] [<c001fa6c>] (warn_slowpath_null) from [<c02313e4>] (_of_add_opp_table_v2+0x94/0x3b4)
[ 3.747854] [<c02313e4>] (_of_add_opp_table_v2) from [<c0231bac>] (dev_pm_opp_of_cpumask_add_table_by_soc_bin+0x80/0xc0)
[ 3.760087] [<c0231bac>] (dev_pm_opp_of_cpumask_add_table_by_soc_bin) from [<c030847c>] (sunxi_cpufreq_init+0x154/0x3bc)
[ 3.772323] [<c030847c>] (sunxi_cpufreq_init) from [<c0304ca4>] (cpufreq_online+0x160/0x604)
[ 3.781820] [<c0304ca4>] (cpufreq_online) from [<c03051ac>] (cpufreq_add_dev+0x54/0x7c)
[ 3.790828] [<c03051ac>] (cpufreq_add_dev) from [<c022148c>] (subsys_interface_register+0xbc/0xc8)
[ 3.800911] [<c022148c>] (subsys_interface_register) from [<c030421c>] (cpufreq_register_driver+0x114/0x1f0)
[ 3.811969] [<c030421c>] (cpufreq_register_driver) from [<c0635c94>] (sunxi_cpufreq_initcall+0x20/0x44)
[ 3.822537] [<c0635c94>] (sunxi_cpufreq_initcall) from [<c0009b00>] (do_one_initcall+0x140/0x174)
[ 3.832524] [<c0009b00>] (do_one_initcall) from [<c061ade4>] (kernel_init_freeable+0x18c/0x1d4)
[ 3.842315] [<c061ade4>] (kernel_init_freeable) from [<c04c4840>] (kernel_init+0x8/0xec)
[ 3.851422] [<c04c4840>] (kernel_init) from [<c000edf0>] (ret_from_fork+0x14/0x24)
[ 3.859959] ---[ end trace 242be0e306f7b58d ]---
[ 3.865160] of: dev_pm_opp_of_cpumask_add_table_by_soc_bin: couldn't find opp table for cpu:1, -2
[ 3.875153] [cpu_freq] ERR: Failed to add opp table
[ 3.881096] cpuidle: enable-method property 'psci' found operations
[ 3.888606] cpuidle: enable-method property 'psci' found operation
原因:获取dts中的vf表异常
解决方法:
tina/lichee/linux-4.9/arch/arm/boot/dts$ git diff .
diff --git a/arch/arm/boot/dts/sun8iw18p1.dtsi b/arch/arm/boot/dts/sun8iw18p1.dtsi
index 923b3c4..ec1df87 100644
--- a/arch/arm/boot/dts/sun8iw18p1.dtsi
+++ b/arch/arm/boot/dts/sun8iw18p1.dtsi
@@ -145,8 +145,27 @@
opp_table_count = <1>;
cpu_opp_l_table0: opp_l_table0 {
+ /* compatible = "operating-points-v2"; */
+ compatible = "allwinner,opp_l_table0";
+ opp_count = <2>;
+ opp-shared;
+
+ opp00 {
+ opp-hz = /bits/ 64 <720000000>;
+ opp-microvolt = <820000>;
+ axi-bus-divide-ratio = <3>;
+ clock-latency-ns = <2000000>;
+ };
+
+ opp01 {
+ opp-hz = /bits/ 64 <1008000000>;
+ opp-microvolt = <900000>;
+ axi-bus-divide-ratio = <3>;
+ clock-latency-ns = <2000000>;
+ };
+ };
+
- };
};
4、全志平台Tina系统查看当前cpu频率的方法
root@TinaLinux:/sys/kernel/debug/clk/pll_cpu# ls
clk_accuracy clk_notifier_count clk_rate
clk_enable_count clk_phase
clk_flags clk_prepare_count
root@TinaLinux:/sys/kernel/debug/clk/pll_cpu# cat clk_rate
1200000000
5、Tina修改adb设备名的方法,让你可以你一台PC连接多台adb设备
1)在源码tina/package/base-files/setusbconfig-config
diff --git a/base-files/setusbconfig-configfs b/base-files/setusbconfig-configfs
index 690b138..d6c0c21 100755
--- a/base-files/setusbconfig-configfs
+++ b/base-files/setusbconfig-configfs
@@ -27,6 +27,7 @@ set_usb_function() {
mkdir /sys/kernel/config/usb_gadget/g1
mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409
echo "Allwinner" > /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer
+ echo "20190001" > /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber
echo "Tina" > /sys/kernel/config/usb_gadget/g1/strings/0x409/product
}
[ -d /sys/kernel/config/usb_gadget/g1/configs/c.1 ] || {
2).在设备中修改:
按照上面的修改内容修改 /bin/setusbconfig文件,修改后重启设备即可。
chenkunyao@ubuntu-chenkunyao:~$ adb devices
List of devices attached
20190001 device
3)修改adb devices的设备ID/设备号
adb shell
键入以下命令:
echo abc >/sys/class/android_usb/android0/iSerial
设备ID就修改成abc 了
6、全志平台Tina系统pwm控制led调试的方法(以R18某方案为例)
1)全志平台Tina系统pwm控制led调试的方法(以R18某方案为例)
sys_config.fe的修改:
--- a/recipes-bsp/tina-board/tulip-noma/configs/sys_config.fex
+++ b/recipes-bsp/tina-board/tulip-noma/configs/sys_config.fex
@@ -534,11 +534,11 @@ pwm_positive = port:PD22<2><0><default><default>
[pwm0_suspend]
pwm_positive = port:PD22<7><0><default><default>
-[pwm16]
-s_pwm0_used = 0
+[spwm0]
+spwm0_used = 1
pwm_positive = port:PL10<2><0><default><default>
-[pwm16_suspend]
+[spwm0_suspend]
pwm_positive = port:PL10<7><0><default><default>
这个LED设计的是MUTE功能开启的时候点亮,所以要先把MUTE打开,调试的时候请先拉高PD4:
root@tulip-mozart:/sys/kernel# mount -t debugfs none debug/
root@tulip-mozart:/sys/kernel/debug/sunxi_pinctrl# echo pio > dev_name
root@tulip-mozart:/sys/kernel/debug/sunxi_pinctrl# echo PD4 > sunxi_pin
root@tulip-mozart:/sys/kernel/debug/sunxi_pinctrl# echo PD4 1 > data
然后:
echo 0 > /sys/class/pwm/pwmchip16/export
echo 100000 > /sys/class/pwm/pwmchip16/pwm0/period
echo 20000 > /sys/class/pwm/pwmchip16/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip16/pwm0/enable
echo 80000 > /sys/class/pwm/pwmchip16/pwm0/duty_cycle
duty_cycle的值限制在0~period的范围内
period是周期,单位是ns。
如果要设置为某频率,比如如果频率想改成200Hz,
1/200Hz=0.005s=5 000 000 ns
这里就要改成5 000 000
然后在这个范围内变化,可以写个3000000什么的进行调试:
echo 0 > /sys/class/pwm/pwmchip16/export
echo 5000000 > /sys/class/pwm/pwmchip16/pwm0/period
echo 3000000 > /sys/class/pwm/pwmchip16/pwm0/duty_cycle
暂时先到这里,后面有遇到的时候进一步总结。