Hi Vicharak Team,
I am trying to use Both PWM ports of AXON board simentensoly with two different frequencies. Sometimes it starts works, in between it give garbage frequency value. From it stops works. I am attacking logs of both pwm below in the chat:
########################################
PWM0 = 17000 Hz
PWM1 = 22000 Hz
----- Testing PWM0 -----
========================================
PWM Path : /sys/class/pwm/pwmchip0/pwm0
Frequency: 17000 Hz
Period : 58823 ns
Duty : 29411 ns
Step 1 : Disable
WRITE: /sys/class/pwm/pwmchip0/pwm0/enable ← 0
Step 2 : Write period
WRITE: /sys/class/pwm/pwmchip0/pwm0/period ← 58823
ERROR configuring /sys/class/pwm/pwmchip0/pwm0
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/vicharak/dual_freq1.py”, line 62, in set_pwm
write(f"{path}/period", period)
File “/home/vicharak/dual_freq1.py”, line 19, in write
with open(path, “w”) as f:
OSError: [Errno 22] Invalid argument
----- Testing PWM1 -----
========================================
PWM Path : /sys/class/pwm/pwmchip1/pwm0
Frequency: 22000 Hz
Period : 45454 ns
Duty : 22727 ns
Step 1 : Disable
WRITE: /sys/class/pwm/pwmchip1/pwm0/enable ← 0
Step 2 : Write period
WRITE: /sys/class/pwm/pwmchip1/pwm0/period ← 45454
Step 3 : Write duty
WRITE: /sys/class/pwm/pwmchip1/pwm0/duty_cycle ← 22727
Step 4 : Enable
WRITE: /sys/class/pwm/pwmchip1/pwm0/enable ← 1
SUCCESS
Period = 45454
Duty = 22727
Enable = 1
Waiting 2 seconds…
########################################
PWM0 = 19000 Hz
PWM1 = 24000 Hz
----- Testing PWM0 -----
========================================
PWM Path : /sys/class/pwm/pwmchip0/pwm0
Frequency: 19000 Hz
Period : 52631 ns
Duty : 26315 ns
Step 1 : Disable
WRITE: /sys/class/pwm/pwmchip0/pwm0/enable ← 0
Step 2 : Write period
WRITE: /sys/class/pwm/pwmchip0/pwm0/period ← 52631
ERROR configuring /sys/class/pwm/pwmchip0/pwm0
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/vicharak/dual_freq1.py”, line 62, in set_pwm
write(f"{path}/period", period)
File “/home/vicharak/dual_freq1.py”, line 19, in write
with open(path, “w”) as f:
OSError: [Errno 22] Invalid argument
----- Testing PWM1 -----
========================================
PWM Path : /sys/class/pwm/pwmchip1/pwm0
Frequency: 24000 Hz
Period : 41666 ns
Duty : 20833 ns
Step 1 : Disable
WRITE: /sys/class/pwm/pwmchip1/pwm0/enable ← 0
Step 2 : Write period
WRITE: /sys/class/pwm/pwmchip1/pwm0/period ← 41666
Step 3 : Write duty
WRITE: /sys/class/pwm/pwmchip1/pwm0/duty_cycle ← 20833
Step 4 : Enable
WRITE: /sys/class/pwm/pwmchip1/pwm0/enable ← 1
SUCCESS
Period = 41666
Duty = 20833
Enable = 1
Waiting 2 seconds…
Disabling PWM outputs…
WRITE: /sys/class/pwm/pwmchip0/pwm0/enable ← 0
WRITE: /sys/class/pwm/pwmchip1/pwm0/enable ← 0
Done.
i have tried every single step to debug it. Kindly assist me or update me asap.




