Whilst writing kernel modules is a useful skill, is this better achieved just from userspace and the sysfs API for PWM?
would set up a 50% duty cycle 1kHz PWM signal.
I think your problem is that just loading a driver from modprobe or /etc/modules is a one off trigger, so it fails and moves on.
If your driver is loaded from device tree, the kernel knows that it's meant to be loaded, knows it failed with a EPROBDEFER, and will automatically retry loading it. You also get to provide a proper DT link to your desired PWM node, rather than hard coding the PWM device name.
Code:
echo 0 > /sys/class/pwm/pwmchip0/exportecho 1000000 > /sys/class/pwm/pwmchip0/pwm0/periodecho 500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycleecho 1 > /sys/class/pwm/pwmchip0/pwm0/enableI think your problem is that just loading a driver from modprobe or /etc/modules is a one off trigger, so it fails and moves on.
If your driver is loaded from device tree, the kernel knows that it's meant to be loaded, knows it failed with a EPROBDEFER, and will automatically retry loading it. You also get to provide a proper DT link to your desired PWM node, rather than hard coding the PWM device name.
Statistics: Posted by 6by9 — Thu Feb 29, 2024 6:10 pm