Swapping Motor Outputs in Software

Hi all,

Is possible to swap motor PWM outputs in software rather than physically switching motor servo inputs?

For instance, motor 1 output is mapped to motor 3 on my quad_x. Can I, in software (at compile time or as a configuration parameter), map motor 1 signal to motor 3’s PWM output pin and visa versa?

If it isn’t currently possible, I’ll just rewire the motor outputs correctly - I am mostly asking out of curiosity.

Thanks again!
Tony

Additional Information:

  • Using px4fmu-v3
  • Configured OUTPUT_MODE to fmu (rather than the default OUTPUT_MODE io)

The only place in the code that I’ve found where I can change the motor output pin is in the src/drivers/boards/px4fmu-v2/board_config.h file. @dagar Is the only option for swapping motor output pins if I modify the following configuration (board_config.h:383):

/* User GPIOs
 *
 * GPIO0-5 are the PWM servo outputs.
 */
#define GPIO_GPIO0_INPUT	(GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN14)
#define GPIO_GPIO1_INPUT	(GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN13)
#define GPIO_GPIO2_INPUT	(GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN11)
#define GPIO_GPIO3_INPUT	(GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN9)

I.e. if I swap GPIO_PIN14 and GPIO_PIN11 and recompile, will the motor output for motor 1 and motor 3 be swapped? If so, is this the only method for swapping motor outputs in software?

Thanks,
Tony

I don’t think I’m following. Why is this necessary? Hacking the mixer would be slightly easier.

One of the solutions is written here: Change motor layout for quad