Milk-v修改并测试pwm10及波形输出

简介

加载pwm模块

[root@cvitek]/mnt/system/ko# ls
3rd                      cv180x_pwm.ko            cv180x_vpss.ko
cfbcopyarea.ko           cv180x_rgn.ko            cv180x_wdt.ko
cfbfillrect.ko           cv180x_rtc.ko            cvi_mipi_rx.ko
cfbimgblt.ko             cv180x_rtos_cmdqu.ko     cvi_vc_driver.ko
cv180x_base.ko           cv180x_saradc.ko         cvi_wiegand.ko
cv180x_clock_cooling.ko  cv180x_sys.ko            cviaudio_core.ko
cv180x_dwa.ko            cv180x_thermal.ko        efivarfs.ko
cv180x_fast_image.ko     cv180x_tpu.ko            fb_ssd1306.ko
cv180x_jpeg.ko           cv180x_vcodec.ko         loadsystemko.sh
cv180x_mon.ko            cv180x_vi.ko             snsr_i2c.ko
insmod /mnt/system/ko/cv180x_pwm.ko
[root@cvitek]/sys/class/pwm# ls
pwmchip0   pwmchip12  pwmchip4   pwmchip8

例子:PWM10

原理图

修改pinmux

image

build\boards\cv180x\cv1800b_sophpi_duo_sd\u-boot\cvi_board_init.c

//PWM10
PINMUX_CONFIG(SD1_GPIO1, PWM_10);

测试

//pwm10,也就是pwmchip8的第三个,也就是pwmchip8/pwm2
echo 2 > /sys/class/pwm/pwmchip8/export
echo 1000000 > /sys/class/pwm/pwmchip8/pwm2/period
echo 500000 > /sys/c
lass/pwm/pwmchip8/pwm2/duty_cycle
echo 1 > /sys/class/pwm/pwmchip8/pwm2/enable

波形

1 Like

为什么还要配置复用,内核模块里面为什么不把复用配置好
不然每次还得从新编译内核,多麻烦的

1 Like