[RISC-V]Milk-V开发板测试pwm及波形输出

[RISC-V]Milk-V开发板测试pwm及波形输出

简介

[RISC-V]Milk-V开发板测试pwm及波形输出_第1张图片

加载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

[RISC-V]Milk-V开发板测试pwm及波形输出_第2张图片

原理图

[RISC-V]Milk-V开发板测试pwm及波形输出_第3张图片

修改pinmux

[RISC-V]Milk-V开发板测试pwm及波形输出_第4张图片

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

//PWM10
PINMUX_CONFIG(SD1_GPIO1, PWM_10);

测试

[RISC-V]Milk-V开发板测试pwm及波形输出_第5张图片

//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

波形

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-f4V7nxjF-1687061570792)(upload://g68pD2ZFRWIEwU3AVMo4smhQxGF.png)]

视频讲解

https://www.bilibili.com/video/BV1uh4y197RS/

你可能感兴趣的:(rsic-v,linux,传感器,单片机,嵌入式硬件,risc-v)