A100 tina pwm7 PI6 测试
-
board.dts:
pio: pinctrl@0300b000 { ... pwm7_pin_a: pwm7@0 { allwinner,pins = "PI6"; allwinner,function = "pwm7"; allwinner,muxsel = <0x04>; allwinner,drive = <0x2>; allwinner,pull = <0>; allwinner,data = <0xffffffff>; }; pwm7_pin_b: pwm7@1 { allwinner,pins = "PI6"; allwinner,function = "io_disabled"; allwinner,muxsel = <0x07>; allwinner,drive = <0x2>; allwinner,pull = <0>; allwinner,data = <0xffffffff>; }; ...
pwm7: pwm7@0300a000 { pinctrl-names = "active", "sleep"; pinctrl-0 = <&pwm7_pin_a>; pinctrl-1 = <&pwm7_pin_b>; status = "okay" };
.config 配置:
CONFIG_PWM=y CONFIG_PWM_SYSFS=y CONFIG_PWM_SUNXI_GROUP=y
-
用io翻转测试pwm:
echo 262 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio262/direction while [ 1 ]; do echo 1 > /sys/class/gpio/gpio262/value ;echo 0 > /sys/class/gpio/gpio262/value ; done;
-
使能pwm7:
echo 7 > /sys/class/pwm/pwmchip0/export echo 25000000 > /sys/class/pwm/pwmchip0/pwm7/period echo 12000000 > /sys/class/pwm/pwmchip0/pwm7/duty_cycle echo 1 > /sys/class/pwm/pwmchip0/pwm7/enable
查看pwm信息:
mount -t debugfs none /sys/kernel/debug; cat /sys/kernel/debug/pwm
# cat /sys/kernel/debug/pwm platform/300a000.pwm, 16 PWM devices pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-2 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-3 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-4 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-5 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-6 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-7 (sysfs ): requested enabled period: 25000000 ns duty: 12000000 ns polarity: normal pwm-8 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-9 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-10 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-11 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-12 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-13 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-14 ((null) ): period: 0 ns duty: 0 ns polarity: normal pwm-15 ((null) ): period: 0 ns duty: 0 ns polarity: normal
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号