Mavlink to FrSky S.Port Passthru Converter for LRS or PX4 Pro

Hi Eric,

Well I am not having much success compiling such changes. As soon as I change the config.h to make my ESP32 a Mavlink switch I get compile errors. Maybe you can see the obvious issue – but I know you are busy.

See config.h attached. I only added the gs_txPin and gs_rxPin definitions to the relevant ESP32 variant 4.

I also made a change to main.ccp at line 1288 as this seems to be where you are handling the GCS mavlink serial.
#if (defined TEENSY3X) || (defined ESP32)

This is my compile error.
src/main.cpp: In function ‘void setup()’:
src/main.cpp:364:5: error: ‘LogScreenPrintln’ was not declared in this scope
LogScreenPrintln("Starting … ");

config.h (84.7 KB)

Hi Marc, I tried your config.h this morning, and it clean compiled for me on Arduino IDE v1.18.19, and with ESP32 board version 2.0.10 (2.0.11 failed with a different minor issue):

After booting, the log says:
Starting MavToPass version:2.68.03
Display support activated: Landscape
64x128 text_size=1 char_w_px=6 char_h_px=8 scr_h_ch=8 scr_w_ch=21
EEPROM initialised successfully
EEPROM settings version:255.255.255
Version change detected. ALL SETTINGS IN EEPROM SET TO COMPILE_TIME DEFAULTS
EEPROM settings read and adopted
No FrSky port support selected or built in
Target Board is ESP32 / Variant is Heltec Wifi Kit 32
Mavlink WiFi In
Mavlink Serial Out
WiFi mode is STA>AP
Protocol is UDP IP-Targeted
No Bluetooth options selected, BT support not compiled in
E (3103) uart: uart_set_pin(692): tx_io_num error
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x4008d720
file: “C:\Users\erics\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.10\cores\esp32\esp32-hal-uart.c” line 215
func: uartBegin
expression: uart_set_pin(uart_nr, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)

abort() was called at PC 0x4008d723 on core 1

I need to deal with some other matters this morning, but I’ll look at it later when I get the chance. I’m assuming you are using a Heltec wifi kit 32 board.

Again I manage to miss your reply! I am actually using PlatformIO – can’t be doing with Arduino. And yes, using a Heltec WiFi board.

Anytime you get to it would be great but no rush. I think it would be great to have this as a configurable option. I am sure I can solve my compile issue. The errors you are seeing seem more germane.

Hi Eric. In addition to the tracker relay in my previous messages, I am making a new Ground Station to replace one stolen from my car. I have a working Dragonlink setup with a Heltech WiFi Kit 32 so this is just happening as fast as it happens. I purchased another Heltech board and found that the V2 that Noircogi got working for this project is not longer available. They are now selling the multi-core ESP S3 version. Of course its a mess with poor documentation and broken libraries. While I can flash it I have not made it work, yet. That likely means no-one else can either without some effort – it is more than just changing pin references. I was thinking about just getting a proper reference board and working with that. I know you are busy and I reckon I can get this up and running. I like the extra button it has well.

Hi Marc, unfortunately I don’t have any s3 boards yet. (I have some c3, c6 and s2s, but of course that’s not going to help). I’ll see if I can get an Adafruit board, but I’m back the SA for a while and shipping through the national post office is broken.

The only coding issue, I think, will be instantiating the correct serial objects (matching uarts with serial object names). I can do some of the basic work for you. The s3 has 3 uarts I believe, uart0 (for flashing and monitor), and uarts 1 and 2. Also, the Adafruit board uses SPI to drive the display, so those pins will not be available for other things.

Ok. Sounds good. I ordered one. I will see how I do and may reach out if I have questions.

Hey Eric,

Sorry it took a while…but here’s the debug info:


Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.614  Bat amps=0.210  mAh=0.410101  Total mAh=0.410  Bat1 cell count= 4
 FrPeriod mS=6317	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.2 pt_bat1_mAh=0 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 190 ap_current_consumed mAh= 1 my di/dt mAh= 0
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.621  Bat amps=0.200  mAh=0.050876  Total mAh=0.461  Bat1 cell count= 4
 FrPeriod mS=1014	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.2 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 1 my di/dt mAh= 0
SPort detected
FrPort read good!
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.627  Bat amps=0.190  mAh=0.050575  Total mAh=0.512  Bat1 cell count= 4
 FrPeriod mS=952	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.630  Bat amps=0.180  mAh=0.051578  Total mAh=0.563  Bat1 cell count= 4
 FrPeriod mS=1028	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.633  Bat amps=0.180  mAh=0.053816  Total mAh=0.617  Bat1 cell count= 4
 FrPeriod mS=1014	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.635  Bat amps=0.180  mAh=0.050575  Total mAh=0.668  Bat1 cell count= 4
 FrPeriod mS=951	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.636  Bat amps=0.180  mAh=0.054666  Total mAh=0.722  Bat1 cell count= 4
 FrPeriod mS=1029	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 190 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.634  Bat amps=0.170  mAh=0.049973  Total mAh=0.772  Bat1 cell count= 4
 FrPeriod mS=996	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.635  Bat amps=0.170  mAh=0.045758  Total mAh=0.818  Bat1 cell count= 4
 FrPeriod mS=969	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.636  Bat amps=0.170  mAh=0.056805  Total mAh=0.875  Bat1 cell count= 4
 FrPeriod mS=1013	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 1 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.637  Bat amps=0.170  mAh=0.050023  Total mAh=0.925  Bat1 cell count= 4
 FrPeriod mS=997	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.638  Bat amps=0.170  mAh=0.052116  Total mAh=0.977  Bat1 cell count= 4
 FrPeriod mS=981	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.636  Bat amps=0.170  mAh=0.053975  Total mAh=1.031  Bat1 cell count= 4
 FrPeriod mS=1016	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.635  Bat amps=0.170  mAh=0.050073  Total mAh=1.081  Bat1 cell count= 4
 FrPeriod mS=998	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.634  Bat amps=0.170  mAh=0.049270  Total mAh=1.130  Bat1 cell count= 4
 FrPeriod mS=982	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.634  Bat amps=0.170  mAh=0.050776  Total mAh=1.181  Bat1 cell count= 4
 FrPeriod mS=1012	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.633  Bat amps=0.170  mAh=0.053072  Total mAh=1.234  Bat1 cell count= 4
 FrPeriod mS=999	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 190 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.633  Bat amps=0.170  mAh=0.052116  Total mAh=1.286  Bat1 cell count= 4
 FrPeriod mS=981	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.633  Bat amps=0.170  mAh=0.050926  Total mAh=1.337  Bat1 cell count= 4
 FrPeriod mS=1015	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.632  Bat amps=0.170  mAh=0.050023  Total mAh=1.387  Bat1 cell count= 4
 FrPeriod mS=998	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.633  Bat amps=0.170  mAh=0.052222  Total mAh=1.439  Bat1 cell count= 4
 FrPeriod mS=982	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.630  Bat amps=0.170  mAh=0.050826  Total mAh=1.490  Bat1 cell count= 4
 FrPeriod mS=1013	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 170 ap_current_consumed mAh= 2 my di/dt mAh= 1
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.630  Bat amps=0.170  mAh=0.052912  Total mAh=1.543  Bat1 cell count= 4
 FrPeriod mS=997	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 2 my di/dt mAh= 2
Mavlink from FC #1 Sys_status:  Sensor health=51479583 Bat volts=16.630  Bat amps=0.170  mAh=0.051478  Total mAh=1.595  Bat1 cell count= 4
 FrPeriod mS=968	Passthru out Bat1 0x5003:  pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=2 pt_payload=0  passthru payload 0x10 00>00>00>00>	....	
Mavlink from FC #147 Battery Status:  bat id= 0 bat current mA= 180 ap_current_consumed mAh= 2 my di/dt mAh= 2

Hi Marc, I’ve added support for the LilyGo T-Display-S3, and also added some code to support your requirement. Github/mav2pt v2.68.06. PIO version included.

Eric - that is so kind of you to do that. I just made some time to finish this project. I am sure you saved me a lot of time mucking about myself. Will try it out shortly and report back.

I went back, and I think this was the question

Im just wondering, on my mav2pt setup (Dragonlink on relay), it works almost perfectly with yaapu telemetry on ethos. However, I noticed that I dont get any data for power and efficiency. all the rest works just fine. Is it something not included in mav2pt?

I can confirm it works if im not using my mav2pt+dragonlink. With my Frsky R9 and crossfire, Im able to fetch those data.

From your debug log above, this looks very suspicious:

FrPeriod mS=952 Passthru out Bat1 0x5003: pt_bat1_volts=16.60 pt_bat1_amps=0.1 pt_bat1_mAh=1 pt_payload=0 passthru payload 0x10 00>00>00>00>

because the power data is there and correct, but the S.Port payload is all zeros.

EDIT: I checked this, and it’s just a debug line error. fixed, but does not solve your problem

I need the version number of your firmware please Erwin

my pleasure. look in “wip” folder on github

1 Like

this is with the FW 2.67.05. THanks for looking at it by the way :wink:

As far as I can see the correct packets are being pushed out of the S.Port pin, so unfortunately I don’t think I can help. Sorry.

thanks for taking time to look at it buddy. probably a yaapu script issue

Eric. Sorry it has taken so long to reply. Your support for S3 and for getting Mavlink in via WiFi and out via UART is working for my antenna tracker link from my Dragonlink. I notice online that almost no-one seems to have the Heltec Wifi Kit 32 V3 (S3) working with Adafruit libraries. However I did manage to get it working with
#define SSD1306_Display // 170 x 320 dot 262K Color TFT LCD
#define SDA 17 // I2C OLED board
#define SCL 18 // I2C OLED board
#define i2cAddr 0x3c // I2C OLED board
#define SCR_ORIENT 1 // 1 Landscape or 0 Portrait

In addition I needed to assign reset to GPIO 21 in the SD1306_Display configurations. I think this should be done in the board configuration section above though, right?
#ifndef OLED_RESET
#define OLED_RESET 21 // Reset pin # (or -1 if sharing Arduino reset pin)
#endif

So I guess you should add support for the Heltec WifiKit 32 V3 as it is the easiest one to buy on Ebay or Amazon (at least in the US). I can send you a tested config.h file for the latest stable release if you like.

Eric,

I have not yet got this working but I will. I think it should be a reference board. You have a multi-colored LED to play with, a nice color OLED display, and three user defined buttons. I would be happy to send you a few of them if you cannot easily get them in SA.

I hope I can get time to add some more features as I am getting more comfortable this flavor of coding. I often need to choose different SSIDs in STA mode (iPad hotspot, Phone hotspot, and Home wifi). It would be great to be able to toggle between these.

Marc, all noted. Its a nice board, but presently out of stock on the web site. The problem here is that the “post office” is broken, but couriers are fine. I could buy some boards in Australia when I go after Christmas.in the meantime take a good look at the llygo t display s3. Nice big colour screen etc. But of course it’s not my call. Il see if I can add your ideas.

Duly noted. I just ordered that LilyGo S3 from Amazon here for $26. It’s morning and Amazon says I will have it today!

It has a neopixel style rgb led, but It’s also easy to add an neopixel RGB strip for status leds. Uses 1 pin, or possibly the same pin as the on board led.

@Eric_Stockenstrom ,

I have a broken OLED on an old Heltec Wifikit 32 V2 on the Dragonlink so I wanted to replace it with an Heltec V3 (S3). I am using your WIP repo to flash another Heltec Wifikit 32 V3 and it seems when I try to compile with conventional options as a ground based Mavlink to SPort telemetry converter I get the following errors. So the WIP repo works as a Mavlink switch but no longer can generate a Frsky telemetry. I do not think this is related to the flavor of S3 ESP32 board.


In file included from src/main.cpp:137:
include/frSky_Ports.h:2986:14: error: no declaration matches ‘uint32_t FrSkyPort::getBaud(uint8_t, pol_t)’
uint32_t FrSkyPort::getBaud(uint8_t s_pin, pol_t pl) {
^~~~~~~~~
In file included from src/main.cpp:137:
include/frSky_Ports.h:159:19: note: candidate is: ‘uint32_t FrSkyPort::getBaud(int8_t, pol_t)’
uint32_t getBaud(int8_t rxpin, pol_t pl);
^~~~~~~
include/frSky_Ports.h:41:13: note: ‘class FrSkyPort’ defined here
class FrSkyPort
^~~~~~~~~
Archiving .pio/build/heltec_wifi_kit_32_V3/libe54/libSPI.a
Indexing .pio/build/heltec_wifi_kit_32_V3/libe54/libSPI.a
Compiling .pio/build/heltec_wifi_kit_32_V3/liba3f/Adafruit_GFX_Library/glcdfont.c.o
Compiling .pio/build/heltec_wifi_kit_32_V3/lib9fc/Adafruit_ILI9341/Adafruit_ILI9341.cpp.o
*** [.pio/build/heltec_wifi_kit_32_V3/src/main.cpp.o] Error 1
Compiling .pio/build/heltec_wifi_kit_32_V3/lib169/BluetoothSerial/BTAddress.cpp.o