Matek l431 - pwm out

Hi Everybody !

I try to use MATEK L431 to control SERVO and LED on my plane. I use ARDUPLANE V4.2 with cube.

The servo (AILERON for my test) plugged in PWM 1 on L431 board. The servo alimentation is not with CANBUS, it’s a separate bec. I plugged the buzzer on the L431 board.

The buzzer works fine but not the servo.
MATEK L431 :

  • Configuration : id 125, Name org.ardupilot.MatekL431-Periph, HW version 4.38, SW version : 1.3.F79C43EE
  • Parameters: GPS_TYPE 0, GPS_PORT -1, COMPASS_ENABLE 0,BATT_MONITOR 0 , BATT2_MONITOR 0, MSP_PORT -1; OUT1_FUNCTION 4

Arduplane :

  • CAN_D1_UC_NODE 10, CAN_D1_UC_SRV_BM 15,CAN_D1_UC_ESC_BM 0

When i use “INSPECTOR” fonction, I see the value changing :
ID 10 - uavcan_equipement_actuator_ArrayCommand - commands - commands[0]

If i plug the servo on Main Out 1 in the carried board. The servo moves correctly.

Do you have any ideas? what am i doing wrong?

Thanks

Hi @Glider4All

I have the same problem with the L431 on a H743 wing(V1) . Would therefore be very interested in how to implement the servo function.

Anyone know how to get the source code (git) of the firmware matekL341-periph?
https://firmware.ardupilot.org/AP_Periph/stable/MatekL431-Periph/

I would like to see how command[i] is interpreted by the node.

Did you get this working? I have one on the way for my boat.

Buzzer works but not the servo for the moment.
The Matek’s responses:

“Sorry, we don’t know how to configure it also.
We tried for days without success.”

1 Like

The code is on ardupilot/Tools/AP_Periph at master · ArduPilot/ardupilot · GitHub

Thanks @amilcarlucas.
Ardupilot node sends the commands : position servo (SERVO1, 2, 3…) and servo value (-1 to 1). But the AP_Periph node uses the OUT_FUNCTION.
How the AP_Periph know the link between the position servo and the function OUT?

You are setting OUT1_FUNCTION 4

That looks wrong to me. Servo 1 is function 51. Servo2 is Function 52 etc.

Not sure on the logic behind this but it works for me.

1 Like

Finally it works ! Thank @tegwin, you are right
OUT1_FUNCTION = 51 ( SERVO1_FUNCTION)
OUT2_FUNCTION = 52 ( SERVO2_FUNCTION) …

The documentation about OUTx_FUNCTION (Complete Parameter List — Dev documentation) is not correct.

Other useful information:

  • the PWM out works only when the L431 is connecting to CAN1.
  • With the cubeBlack, MatekL431 is not visible with droneCAN/UAVCAN tab in mission Planner. I need to use DRONECAN GUI TOOL with the bus number 2 to modify the parameters.
  • OUT_GPIO_MASK : 0 works perfectly for the 5 pwm out.
  • OUTx_MIN, OUTx_MAX, OUTx_TRIM work fine.

Please do a pull request to fix/update the ardupilot_wiki documentation.

I’ve written a blog post on how to set this up:

1 Like

Thank you @tridge !! It’s very helpful