How can I have a full range PWM output?

I want to get it to work, that the pwm output pulsewidth is zero, when ardupilot wants the motor not to run and that the pwm pulsewidth is max (the duty cycle is 100%) when ardupilot wants the motor to run at full speed. I didn’t get it to work by my own.

Additional information:
The goal is that the pwm output is driving a MOSFET transistor, which is driving the motor.

Have you tried following these instructions to use “brushed” motor type?

well, it says that a dutycycle output for brushed motors is supported, but how can I get to this “dutycycle-output”?

by following those instructions, of course.

On the page it says that ardupilot supports this duty cycle mode but there are no instructions telling me how to set the duty cycle range to 0-100$. Please show me where I can find those instructions.

I haven’t used that output mode myself, but you should find that SERVOn_MIN corresponds to 0% and _MAX to 100% duty cycle for the brushed motor type. Probably best to leave those parameters at the default values for brushed mode.

but I thought those parameters define the pulsewidth in microseconds, not the dutycycle.

Most of the code is written to generate motor outputs in the range PWM_MIN to PWM_MAX, which is nominally from 1000 to 2000 usec for output to ESCs. If you select brushed motor type, this range is converted to the appropriate duty cycle. So think of 1000 usec (PWM_MIN) as 0% duty cycle and 2000 usec (PWM_MAX) as 100% and give it a try.

If you are interested in the code that does the translation, it is here:

Ok thank you! And should I also set the esc_min and _max to 1000 and 2000? or what should I do with them?

Yes, I think PWM_MIN/MAX probably default to 1000/2000, and that is probably best.


Were you able to find a way to get 0%-100%duty cycle?
If yes , can you please share method to do it .

change MOT_PWM_TYPE to 3 or 4 depending upon you and you will get 0 to 100% duty cycle for the output of main out 1-4