Changing publishing frequency of a single PWM output

Is it possible to change the frequency of a single PWM output pin? I want to connect a watchdog timer to the pixhawk. This watchdog timer requires a PWM signal of 50% duty cycle at 350 Hz.

Also, what is the maximum allowed frequency at which a PWM output can be sent? I have heard that the loop runs in PX4 runs at 400 Hz, so we can’t go beyond that. Can we increase the loop frequency?

The frequency of the PWM outputs are either 50 Hz or 400 Hz. That’s fixed at the moment, I think.

However, loop times of the controllers can be faster, see:

1 Like

@JulianOes How do we change the frequency of a single PWM output from 50 Hz to 400 Hz? If we change the PWM _RATE value from 50 to 400, wouldn’t it change the frequency of all the PWM outputs?

You can only change groups of outputs which are on the same timer. Therefore, you need to find a way to separate non-digital servos which do not cope with 400 Hz on other timer groups. If you don’t have any old servos, you can probably just switch everything to 400 Hz.

You can find the timer groups using the pwm command

These settings can be applied using the pwm command but they are not saved, so after a reboot it’s reset. If you need them to stick you need to set the param PWM_RATE for the main outputs and PWM_AUX_RATE for the aux outputs.

1 Like

Instead, is it possible to change the duty cycle of a PWM signal, coming from pin 7 (RC7 / P7) of the pixhawk?
If so, in which file is the relative code and with what software can I edit it?