MATEK F405-STD: Enable Servo Output on S7 PAD
Hello!
I want to setup a Servo Gimbal on Matek F405 STD board.
The pitch servo on s6 works. But i can't figure out how to setup the roll servo. I thougt it must be s7 pad. I also can't resource anything through CLI.
In Betaflight 3.3 everything works fine.
Am I doing something wrong?
Thank You!
What type of aircraft ? The camera gimbal should be connected to the first two servo outputs 1->pitch, 2 -> roll.
Resource remapping is not available.
Yes sorry i forgot... :D
Quad X with MATEK F405 SERVO S6 Firmware. So i think S6 is servo out 1, and S7 servo out 2.
I'm using FCHUB6S. So a different motor wiring is not what i wanna do.
Another option is moving the LED_Strip from S5 to S7. So it might be possible to use S5 and S6 for servos.
The MATEKF405 target only offers one servo output by default so unless you build a custom firmware you will only get an output for the pitch on S1 for the MATEKF405 target and S6 for the MATEKF405_SERVOS6 target.
Ok. Thank you for your fast answer. In this case i will go back to Betaflight. Maybe alt hold and poshold work there...
Hello!
Can you explain me how to compile a custom firmware? Is this compiled with eclipse and gnu arm toolchain? (I found a setup guide for STM32F4 using this)
In Beataflight resourcing the servos to s5, s6 and led_strip to s7 works. but alt_hold and pos_hold is really bad.
Thank you!
Actually you don't even need Eclipse or any IDE to build a custom firmware, you can compile it with a command line. All you need to install is described here: https://github.com/iNavFlight/inav/tree/master/docs/development
@Technikfreak2002 Once you installed what's needed following the documentation @alexeystn posted and you can build the firmware you need to edit the file src/main/target/MATEKF405/target.c. Replace TIM_USE_MC_MOTOR or TIM_USE_MC_CHNFW with TIM_USE_MC_SERVO for the output you want to transform from a motor or forwarding output to a servo output. The only rule you need to follow is to never assign a to a servo output an output that uses the same timer as a motor output. For example S2 (motor output) uses timer 8 (TIM8 in first column) so you can't change S3 which uses also TIM8 to a servo output. But you can change S7 to a servo output since it is the only output using timer 4 like that:
Change:
{ TIM4, IO_TAG(PB8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM4, TIM_USE_MC_CHNFW | TIM_USE_FW_MOTOR }, //S7 DMA1_ST7 MT2
to
{ TIM4, IO_TAG(PB8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM4, TIM_USE_MC_SERVO | TIM_USE_FW_MOTOR }, //S7 DMA1_ST7 MT2
You will get 2 servos outputs. For example with MATEKF405_SERVOS6 one servo output on S6 and another one on S7. So you will get for the servo gimbal feature pitch on S6 and roll on S7.
Thank you very much! I will try that! I've set up everything using WSL on Windows 10. It compiles! (without changes yet) So lets try...
I have the servos working on s5 and s6. But the led_strip on s7 does not work. I edited the code in target.c and target.h. target.c
#ifdef MATEKF405_SERVOS6
{ TIM2, IO_TAG(PA15), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM2, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO }, //S5 DMA1_ST5 SV6
#else
{ TIM2, IO_TAG(PA15), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM2, TIM_USE_MC_MOTOR | TIM_USE_LED | TIM_USE_FW_SERVO }, //S5 DMA1_ST5 2812LED
#endif
#ifdef MATEKF405_SERVOS6
{ TIM1, IO_TAG(PA8), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM1, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO }, //S6 DMA2_ST6 SV7
#else
{ TIM1, IO_TAG(PA8), TIM_Channel_1, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO },
#endif
#ifdef MATEKF405_SERVOS6
{ TIM4, IO_TAG(PB8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM4, TIM_USE_MC_CHNFW | TIM_USE_LED | TIM_USE_FW_MOTOR }, //S7 DMA1_ST7 2812LED
#else
{ TIM4, IO_TAG(PB8), TIM_Channel_3, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM4, TIM_USE_MC_CHNFW | TIM_USE_FW_MOTOR }, //S7 DMA1_ST7 MT2
#endif
target.h
#define USE_LED_STRIP
#ifdef MATEKF405_SERVOS6
#define WS2811_PIN PB8 // S7 pad for iNav
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST7_HANDLER
#define WS2811_DMA_STREAM DMA1_Stream7
#define WS2811_DMA_CHANNEL DMA_Channel_3
#else
#define WS2811_PIN PA15 // S5 pad for iNav
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST5_HANDLER
#define WS2811_DMA_STREAM DMA1_Stream5
#define WS2811_DMA_CHANNEL DMA_Channel_3
#endif
I thougt the defines schould do the work.
If this is ok, what files are for the led_stip? I found light_ws2811strip files. Do i have to edit them?
I will move the led strip to s7 because 5v and GND are next to it. Makes wiring a lot easier.
Thank you!
Great :)
Unfortunately I don't know enough about DMAs yet to help you changing the LED_STRIP pin.
@shellixyz Thank you again for your help!
I could not get the led_strip to work on S7. So I put the servo back there. The little change in the code, you posted, did it!
Now everything works! :D
Thanks and happy flying!
@Technikfreak2002 Can you help me with the 2 servos? I modified the FW some times, I could set the servos to s5,6,7 but never worked 2 servos in the same time, and the S7 at all :S So I have Matekf405-std x quad with SERVOS6 FW LED is on S5. Could I have 2 servos in inav with this FC?
Thanks!
@haka002 As far as I remember I used the SERVOS6 version with the same board. I made shellixyz's changes and compiled the firmware. And it worked. But INAV at all doesn't work well so I changed back to ardupilot.
I have the same problem. Can you send me a customize firmware for matek f405std? I need only 2 servo on s5 e s6 and if you can let me to use them it is good for me.
I need that custom firmware for the Matek F405-STD as well. I am wanting to put a pan/tilt gimbal on my iNav long range multirotor.
iNav S5 is led output. so s6 to servo 1, s7 to servo 2 ?
Hi, I would be grateful if you send me the firmware for 405-STD servo 6, with a working servo on s7.
Is it at ALL possible to have all 7 outputs enabled? 4 for motors, 3 for servos? I've gotten 4 and 2 to work, but there seems to be some sort of DMA conflict keeping S7 from working when 5 and 6 are enabled.
Evidently, yes you CAN, but you have to comment out #define USE_LED_STRIP in target.h, which then keeps the settings from being verified because it breaks verification of the LED_STRIP settings
This can be resolved (hacked) by modifying src/main/fc/settings.yaml and commenting out the section on the PG_LED_STRIP_CONFIG
Not sure why disabling the LED strip functionality in target.h doesn't automatically make the validation system skip over the settings associated with it. That might be a bug to address.