Matek H743 Servo ports as GPIO?

I was wondering if servo ports S1-S12 or LED on the Matek H743 could be used as general GPIO to control a relay etc via a appropriate driver transistor or optocoupler. I just want to turn some spot flood lights on and off. I don’t if the ports a just PWM servo or GPIO ports.

With Arducopter 4.2 I think you simply need to set the SERVOx_FUNCTION to -1 for GPIO.

From the Hwdef file:
Outputs

Thanks Dave, Ardupilot never ceases to amaze me with things it can potentially do. Think of on an idea and someone has already done it! I should have looked more at full parameter list then I would have seen GPIO -1

I think I initially got confused with UART ports which are hardware based, looking at the ST PDF the GPIO ports can sink or source 20mA which is more than enough to switch a transistor or optocoupler on.

Just for the record I don’t have any RC stuff at all radio, rc or quad.
Dave.

This is new implementation for v4.2. Gone is the BRD_PWM_COUNT parameter that used to define this. I suspect it will take awhile for this to catch on! That parameter generated a lot of questions on the forum or was related to issues seen. This solution is super simple.

Ah ok, so the image I posted is from SITL and the current version is still using the old BRD_PWM_COUNT method?

Yes. If you load 4.1.5 in SITL it will be there. Interestingly so is the GPIO option for Servo outs but it wouldn’t actually work.

I’m pretty sure the parameter descriptions are version agnostic…meaning that if you update to the latest beta MP, you get the latest parameter descriptions, even if they are ahead of your present autopilot version.

1 Like