inav icon indicating copy to clipboard operation
inav copied to clipboard

Revised: Matek f411 wing softserial fullduplex

Open joeclone opened this issue 7 years ago • 15 comments

I need to use softserial for mavlink telemetry but I think because SS for this target is setup for halfduplex it does not work for my needs. I've tried flashing betaflight target matekf411 setup, resource for SS and ran tlm_halfduplex=off to test this and I can get mavlink to work. Is it possible inav dev to make a matekf411 target with softserial halfduplex=off?

joeclone avatar Mar 23 '19 16:03 joeclone

There is no half duplex setting for telemetry for now. It will probably appear in a future version.

shellixyz avatar Mar 24 '19 21:03 shellixyz

Is it possible to make it work if we compile a new build for this target with the softserial rx assigned to another pin? In the target.h file...

#define SOFTSERIAL_1_TX_PIN PA0 // ST1 pad #define SOFTSERIAL_1_RX_PIN PA0

joeclone avatar Mar 24 '19 23:03 joeclone

Maybe. You can try. Don't forget to define a timer in target.c for the new pin you're going to use for RX.

shellixyz avatar Mar 24 '19 23:03 shellixyz

I'm no coder, tried to compile a build but I'm stuck at usr/bin/sh: ruby: command not found. I've compiled betaflight before without Ruby but can't get inav compile running with ruby in the mix.

joeclone avatar Mar 24 '19 23:03 joeclone

You can find docs to help you set up a build environment here: https://github.com/iNavFlight/inav/tree/master/docs/development

shellixyz avatar Mar 25 '19 15:03 shellixyz

DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), //softserial_tx2 - 2812LED TIM_USE_LED DEF_TIM(TIM5, CH1, PA0, TIM_USE_PPM, 0, 0), //use rssi pad for PPM/softserial_tx1

I'm planning to use PA8 for softserial RX1, which line should I change to reflect this? Would this be correct? DEF_TIM(TIM5, CH1, PA8, TIM_USE_ANY, 0, 0), //softserial_RX1 - 2812LED TIM_USE_LED DEF_TIM(TIM5, CH1, PA0, TIM_USE_PPM, 0, 0), //use rssi pad for PPM/softserial_tx1

And this? #else #define USE_SOFTSERIAL1 #define SOFTSERIAL_1_TX_PIN PA0 // ST1 pad #define SOFTSERIAL_1_RX_PIN PA8 #define SERIAL_PORT_COUNT 4 #endif

joeclone avatar Mar 28 '19 11:03 joeclone

All you need to do is: #define SOFTSERIAL_1_RX_PIN PA8

shellixyz avatar Mar 28 '19 14:03 shellixyz

No need to make changes to timers?

joeclone avatar Mar 28 '19 14:03 joeclone

No since the timer defined for PA8 (TIM1) is already independent of all the other used timers

shellixyz avatar Mar 28 '19 14:03 shellixyz

After spending a whole week messing with getting Inav compiled finally got it working. Tried all modes of compiling on Windows none worked, had to settle on a steep learning curve with Ubuntu. Thanks to @shellixyz for his help and pointers, finally got this softserial fullduplex working nicely on MatekF411 board doing Mavlink telemetry to Qlrs lora system.

@shellixyz if I do this, would it still work? #define SOFTSERIAL_1_RX_PIN NONE

joeclone avatar Mar 29 '19 14:03 joeclone

Not sure. I think setting this to none is the same as setting both RX and TX to the same pin

shellixyz avatar Mar 29 '19 14:03 shellixyz

Indeed setting it to none it falls back to halfduplex. So as of now I'm stuck losing an output for fullduplex telemetry. Will have to wait for code revision for tlm_halfduplex=off option for inav.

joeclone avatar Mar 31 '19 00:03 joeclone

@joeclone how did you solve this and which pins did you use ... plan to use the inav ESP32 LORA on this soft serial ...

SnappyDIY avatar Apr 13 '19 13:04 SnappyDIY

Changed the SFTSRL2 Version to use S5 and S6 for Serial2 - had test this with GPS - works fine!

#if defined(MATEKF411_SFTSRL2) #define USE_SOFTSERIAL1 #define SOFTSERIAL_1_TX_PIN PA0 // ST1 pad #define SOFTSERIAL_1_RX_PIN PA0 #define USE_SOFTSERIAL2 #define SOFTSERIAL_2_TX_PIN PB3 // S5 #define SOFTSERIAL_2_RX_PIN PB10 // S6 #define SERIAL_PORT_COUNT 5

SnappyDIY avatar Apr 13 '19 14:04 SnappyDIY

@SnappyFPV Hey! I really like to use a gps in s5/6, can you send me your Firmware for the FC? I don't know how to edit this ! Huge thanks!

FinnGrndl avatar May 27 '20 05:05 FinnGrndl