Passthrough telemetry over CRSF (crossfire)

radiomaster TX16S 2.3.10 yaapu 1.9.3 => same as mine.
Could you upload your FC arduplane param config file from Qgroundcontrol export tool ? so that i can compare with mine ?

sure, this in an untuned build though :slight_smile:matek_h743_crsf_cangps.zip (7.3 KB)

Cannot compare, text file use diffenrent syntax. What was your export tool to generate mav.parm ?

uh… I used mavproxy… wait I’ll try with QGC

its already on 4.0.8

matekh743_crsf_cangps_qgc.params.zip (8.0 KB) here you go

thanks, after comparing and uploading your config, same result. So it may be a hardware issue.

Did you shielded or twisted your wire for CRSF TX & RX ?
May I have a picture of your FC + TBS nano RX ?

I did a new soldering on a brand new TBS nano RX using twisted + shielded cable on CRSF TX & RX pin. Let’s say my hardware is “perfect” now.

Test case 1 :
When I constantly move my plane in the Roll Axis from -20° to +20°, and so on… during 60 seconds at least, then I have two data output to compare, but only focusing on the roll axis to simplify the protocol :

  • Model -> Telemetry page: The roll telemetry line as blinking star (showing is it updated), with a kind of cyclic rate value which period is about 8/10 sec : 4 sec with a high refresh rate, 4sec with a slow refresh rate, an so on, since it is cyclic. Roll value is always updated, but refresh rate is cyclic
  • yaapu Widget 1.9.3-beta: cyclic behaviour made of 4 sec of high refhresh rate , 4 sec of no refresh rate / freeze Roll value is not always updated, with long freeze period During those freeze periods, the whole HUD is frozen, but the top bar(RSSI) and the bottom bar (Logs) keep updating.

Alex, Could you try to reproduce this issue following the above protocol ?

EDIT 1 : Also tested with RF Profile = 150Hz (forced), same issue.

pier@pier-virtual-machine:~/yaapu/ardupilot$ make plane KakuteF7
Build for vehicle plane
Waf: Entering directory `/home/pier/yaapu/ardupilot/build/KakuteF7’

Checking for env.py
env added BOARD_FLASH_SIZE=1024
env added PROCESS_STACK=0x2000
env added APJ_BOARD_TYPE=STM32F745xx
env added PERIPH_FW=0
env added USBID=0x1209/0x5741
env added MAIN_STACK=0x600
env added APJ_BOARD_ID=123
env added CORTEX=cortex-m4
env added FLASH_TOTAL=950272
env added FLASH_RESERVE_START_KB=96
env added CHIBIOS_BUILD_FLAGS=USE_FATFS=yes MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1 CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F7xx/platform.mk CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f7xx.mk
env appended CPU_FLAGS=[’-mcpu=cortex-m4’, ‘-mfpu=fpv4-sp-d16’, ‘-mfloat-abi=hard’, ‘-DARM_MATH_CM4’, ‘-u_printf_float’]
env added IOMCU_FW=0
env added WITH_FATFS=1
Embedding file bootloader.bin:/home/pier/yaapu/ardupilot/Tools/bootloaders/KakuteF7_bl.bin
Embedding file font0.bin:libraries/AP_OSD/fonts/font0.bin
Embedding file font1.bin:libraries/AP_OSD/fonts/font1.bin
Embedding file font2.bin:libraries/AP_OSD/fonts/font2.bin
Embedding file font3.bin:libraries/AP_OSD/fonts/font3.bin
Embedding file hwdef.dat:/home/pier/yaapu/ardupilot/build/KakuteF7/hw.dat
[601/663] Compiling ArduPlane/commands.cpp

[661/663] Linking build/KakuteF7/bin/arduplane
/home/pier/gcc-arm-none-eabi-5_4-2016q2/bin/…/lib/gcc/arm-none-eabi/5.4.1/…/…/…/…/arm-none-eabi/bin/ld: bin/arduplane section .text' will not fit in region flash’
/home/pier/gcc-arm-none-eabi-5_4-2016q2/bin/…/lib/gcc/arm-none-eabi/5.4.1/…/…/…/…/arm-none-eabi/bin/ld: region `flash’ overflowed by 6212 bytes
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/pier/yaapu/ardupilot/build/KakuteF7’
Build failed
-> task in ‘bin/arduplane’ failed (exit status 1):
{task 139824893995472: cxxprogram AP_Arming.cpp.36.o,ArduPlane.cpp.36.o,Attitude.cpp.36.o,GCS_Mavlink.cpp.36.o,GCS_Plane.cpp.36.o,Log.cpp.36.o,Parameters.cpp.36.o,Plane.cpp.36.o,RC_Channel.cpp.36.o,afs_plane.cpp.36.o,altitude.cpp.36.o,avoidance_adsb.cpp.36.o,commands.cpp.36.o,commands_logic.cpp.36.o,control_modes.cpp.36.o,ekf_check.cpp.36.o,events.cpp.36.o,failsafe.cpp.36.o,geofence.cpp.36.o,is_flying.cpp.36.o,mode.cpp.36.o,mode_acro.cpp.36.o,mode_auto.cpp.36.o,mode_autotune.cpp.36.o,mode_avoidADSB.cpp.36.o,mode_circle.cpp.36.o,mode_cruise.cpp.36.o,mode_fbwa.cpp.36.o,mode_fbwb.cpp.36.o,mode_guided.cpp.36.o,mode_initializing.cpp.36.o,mode_loiter.cpp.36.o,mode_manual.cpp.36.o,mode_qacro.cpp.36.o,mode_qautotune.cpp.36.o,mode_qhover.cpp.36.o,mode_qland.cpp.36.o,mode_qloiter.cpp.36.o,mode_qrtl.cpp.36.o,mode_qstabilize.cpp.36.o,mode_rtl.cpp.36.o,mode_stabilize.cpp.36.o,mode_takeoff.cpp.36.o,mode_thermal.cpp.36.o,mode_training.cpp.36.o,motor_test.cpp.36.o,navigation.cpp.36.o,parachute.cpp.36.o,qautotune.cpp.36.o,quadplane.cpp.36.o,radio.cpp.36.o,reverse_thrust.cpp.36.o,sensors.cpp.36.o,servos.cpp.36.o,soaring.cpp.36.o,system.cpp.36.o,tailsitter.cpp.36.o,takeoff.cpp.36.o,tiltrotor.cpp.36.o,tuning.cpp.36.o -> arduplane}
(run with -v to display more information)
Makefile:27: recipe for target ‘plane’ failed
make: *** [plane] Error 1
pier@pier-virtual-machine:~/yaapu/ardupilot$ git branch -vv
master 0e40d1cb6b [origin/master] autotest: correct key for Rover -> APMrover2 in skidsteer test

  • pr 7d1a81a728 [origin/pr/crsf_telem_passthrough] AP_RCTelemetry: apply a 5s hysteresis to RF mode changes and rate reporting
    pier@pier-virtual-machine:~/yaapu/ardupilot$

Hi Alex,
It seems that your branch compiles my flight control target image file is too large.

[ 958/1172] Compiling ArduCopter/autoyaw.cpp
[ 961/1172] Compiling ArduCopter/esc_calibration.cpp
…/…/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp: In member function ‘void AP_Frsky_MAVliteMsgHandler::handle_command_long(const AP_Frsky_MAVlite_Message&)’:
…/…/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp:21:44: error: cannot bind packed field ‘mav_command_long.__mavlink_command_long_t::command’ to ‘uint16_t& {aka short unsigned int&}’
if (!rxmsg.get_uint16(mav_command_long.command, 0)) {
^
compilation terminated due to -Wfatal-errors.

Waf: Leaving directory `/home/pier/yaapu/ardupilot/build/KakuteF7’
Build failed
-> task in ‘objs/AP_Frsky_Telem’ failed (exit status 1):
{task 139820348783184: cxx AP_Frsky_MAVliteMsgHandler.cpp -> AP_Frsky_MAVliteMsgHandler.cpp.0.o}
(run with -v to display more information)
Makefile:31: recipe for target ‘KakuteF7’ failed
make: *** [KakuteF7] Error 1
pier@pier-virtual-machine:~/yaapu/ardupilot$ git status
On branch pr
Your branch is up to date with ‘origin/pr/crsf_telem_passthrough’.

nothing to commit, working tree clean
pier@pier-virtual-machine:~/yaapu/ardupilot$

There is another error here, please help !

please test the same on latest master which has support for CRSF, I doubt the issue are my patches

That board is problematic from a flash space perspective, you will have to cut some other things out I think to get it to fit

The messages you are getting are coming from the FC - so you clearly are getting telemetry data, I would guess that it’s just the rate that is the problem.

Compiles fine here

bin/arduplane 932484 4500 257724 1194708
bin/arducopter 929160 4584 257640 1191384
bin/arducopter-heli 915140 4584 257644 1177368

assuming you checked out my pr/crsf_telem_passthrough:

git status (to confirm you rae in the correct branch pr/crsf_telem_passthrough)
git remote -v (to confirm origin is pointing to my github repo)
git reset --hard origin/pr/crsf_telem_passthrough (to force resync with my branch)
git submodule update --init --recursive (to force sync for all modules)
./waf configure --board KakuteF7Mini
./waf clean
./waf plane

Edit: checking for kakuteF7 as well, hold on

pier@pier-virtual-machine:~/yaapu/ardupilot$ git diff
diff --git a/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp b/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp
index ac954923c0…f999a5b832 100644
— a/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp
+++ b/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp
@@ -17,9 +17,9 @@ void AP_Frsky_MAVliteMsgHandler::handle_command_long(const AP_Frsky_MAVlite_Mess
uint8_t cmd_options;
float params[7] {};

  • if (!rxmsg.get_uint16(mav_command_long.command, 0)) {
  • /*if (!rxmsg.get_uint16(mav_command_long.command, 0)) {
    return;
  • }
  • }*/
    if (!rxmsg.get_uint8(cmd_options, 2)) {
    return;
    }
    diff --git a/libraries/AP_HAL_ChibiOS/hwdef/KakuteF7/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/KakuteF7/hwdef.dat
    index f92bc3d1d3…1467597d8b 100644
    — a/libraries/AP_HAL_ChibiOS/hwdef/KakuteF7/hwdef.dat
    +++ b/libraries/AP_HAL_ChibiOS/hwdef/KakuteF7/hwdef.dat
    @@ -142,7 +142,7 @@ define HAL_BOARD_TERRAIN_DIRECTORY “/APM/TERRAIN”

setup for OSD

define OSD_ENABLED 1
-define OSD_PARAM_ENABLED 0
+define OSD_PARAM_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

@@ -157,5 +157,9 @@ define HAL_BATTMON_FUEL_ENABLE 0
define HAL_PARACHUTE_ENABLED 0
define HAL_SPRAYER_ENABLED 0

+# save FLASH, but leave above when flash issue is fixed
+define HAL_MINIMIZE_FEATURES 1
+
+

reduce max size of embedded params for apj_tool.py

define AP_PARAM_MAX_EMBEDDED_PARAM 1024
diff --git a/libraries/AP_RCTelemetry/AP_CRSF_Telem.h b/libraries/AP_RCTelemetry/AP_CRSF_Telem.h
index 8f2254cd6c…d5040e7ed6 100644
— a/libraries/AP_RCTelemetry/AP_CRSF_Telem.h
+++ b/libraries/AP_RCTelemetry/AP_CRSF_Telem.h
@@ -18,11 +18,11 @@
#include <AP_HAL/AP_HAL_Boards.h>

#ifndef HAL_CRSF_TELEM_ENABLED
-#define HAL_CRSF_TELEM_ENABLED !HAL_MINIMIZE_FEATURES
+#define HAL_CRSF_TELEM_ENABLED TRUE //!HAL_MINIMIZE_FEATURES
#endif

#ifndef HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED
-#define HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED HAL_CRSF_TELEM_ENABLED && BOARD_FLASH_SIZE > 1024
+#define HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED HAL_CRSF_TELEM_ENABLED// && BOARD_FLASH_SIZE >= 1024
#endif

#if HAL_CRSF_TELEM_ENABLED

Hi Alex,
I have just been testing latest arduplane (cb5be4fcc1a842b9e9426ed79eb57759e168a67e)

In my TX16S OpenTX , at the Model -> Telemetry page, the Pitch/Roll/Yaw telemetry line are updating very fast, at a constant frequency (measure from the blinking star freq). I guess the issue may come from your PR branch…

I did make a quick review of your ardupilot patches, at least, the d917cb9930b2dcd83983535226a17c5a0bc61e86 commit may have an impact on roll/pitch/yaw update ratz since the ATTITUDE scheduler freq may be updated :
+void AP_CRSF_Telem::enter_scheduler_params_mode()
+{
+ set_scheduler_entry(HEARTBEAT, 50, 100); // heartbeat 10Hz
+ set_scheduler_entry(ATTITUDE, 50, 120); // Attitude and compass 8Hz
+ set_scheduler_entry(BATTERY, 1300, 500); // battery 2Hz
+ set_scheduler_entry(GPS, 550, 280); // GPS 3Hz
+ set_scheduler_entry(FLIGHT_MODE, 550, 500); // flight mode 2Hz
+
+ disable_scheduler_entry(PASSTHROUGH);
+ disable_scheduler_entry(STATUS_TEXT);
+}
+
+void AP_CRSF_Telem::exit_scheduler_params_mode()
+{
+ // setup the crossfire scheduler for custom telemetry
+ set_scheduler_entry(BATTERY, 1000, 1000); // 1Hz
+ set_scheduler_entry(ATTITUDE, 1000, 1000); // 1Hz
+ set_scheduler_entry(FLIGHT_MODE, 1200, 2000); // 0.5Hz
+ set_scheduler_entry(HEARTBEAT, 2000, 5000); // 0.2Hz
+
+ enable_scheduler_entry(PASSTHROUGH);
+ enable_scheduler_entry(STATUS_TEXT);
+
+ update_custom_telemetry_rates(_telem_rf_mod

What is your view regarding the potential root causes ? Could you please try to reproduice the issue on your setup H743-WING + TX16S , using the above protocol i have been describing ?

Finally, I made a modification on your 0.9 version, and the lua option appeared successfully and can be set successfully. I sincerely hope that @yaapu can incorporate the changes into your version. thanks @yaapu and @andyp1per

not sure what you’re talking about, forget 0.9, compile my branch which has support for lua params support,
on kakuteF7 hwdef:

define HAL_PARACHUTE_ENABLED 0
define HAL_SPRAYER_ENABLED 0

+define HAL_CRSF_ENABLED 1
+define HAL_MSP_ENABLED 1

'# save FLASH, but leave above when flash issue is fixed
define HAL_MINIMIZE_FEATURES 1

and compile, I get:

bin/arduplane 863636 1356 260876 1125868
bin/arducopter 846220 1368 260868 1108456
bin/arducopter-heli 832000 1368 260864 1094232

Once CRSF custom telemetry kicks in regular CRSF telemetry is slowed down to maintain aggregated bandwidth around 20Hz, that’s why you see slow sensor refresh, but it’s still set to 1Hz.
I’m sorry but right now I don’t have an answer for your issue as I can’t reproduce it

pier@pier-virtual-machine:~/yaapu/ardupilot$ ./waf plane
Waf: Entering directory `/home/pier/yaapu/ardupilot/build/KakuteF7’
Checking for env.py
env added BOARD_FLASH_SIZE=1024
env added PROCESS_STACK=0x2000
env added APJ_BOARD_TYPE=STM32F745xx
env added PERIPH_FW=0
env added USBID=0x1209/0x5741
env added MAIN_STACK=0x600
env added APJ_BOARD_ID=123
env added CORTEX=cortex-m4
env added FLASH_TOTAL=950272
env added FLASH_RESERVE_START_KB=96
env added CHIBIOS_BUILD_FLAGS=USE_FATFS=yes MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1 CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F7xx/platform.mk CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f7xx.mk
env appended CPU_FLAGS=[’-mcpu=cortex-m4’, ‘-mfpu=fpv4-sp-d16’, ‘-mfloat-abi=hard’, ‘-DARM_MATH_CM4’, ‘-u_printf_float’]
env added IOMCU_FW=0
env added WITH_FATFS=1
Embedding file bootloader.bin:/home/pier/yaapu/ardupilot/Tools/bootloaders/KakuteF7_bl.bin
Embedding file font0.bin:libraries/AP_OSD/fonts/font0.bin
Embedding file font1.bin:libraries/AP_OSD/fonts/font1.bin
Embedding file font2.bin:libraries/AP_OSD/fonts/font2.bin
Embedding file font3.bin:libraries/AP_OSD/fonts/font3.bin
Embedding file hwdef.dat:/home/pier/yaapu/ardupilot/build/KakuteF7/hw.dat
[4/9] Creating build/KakuteF7/modules/ChibiOS/include_dirs
[9/9] Linking build/KakuteF7/modules/ChibiOS/libch.a
[156/663] Compiling libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp
[159/663] Compiling libraries/AP_GPS/RTCM3_Parser.cpp
[160/663] Compiling libraries/AP_GPS/MovingBase.cpp
[161/663] Compiling libraries/AP_GPS/GPS_Backend.cpp
[163/663] Compiling libraries/AP_GPS/AP_GPS_UBLOX.cpp
[164/663] Compiling libraries/AP_GPS/AP_GPS_SIRF.cpp
[165/663] Compiling libraries/AP_GPS/AP_GPS_SBP2.cpp
[167/663] Compiling libraries/AP_GPS/AP_GPS_SBP.cpp
[168/663] Compiling libraries/AP_GPS/AP_GPS_NOVA.cpp
[169/663] Compiling libraries/AP_GPS/AP_GPS_MTK19.cpp
[170/663] Compiling libraries/AP_GPS/AP_GPS_GSOF.cpp
…/…/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp: In member function ‘void AP_Frsky_MAVliteMsgHandler::handle_command_long(const AP_Frsky_MAVlite_Message&)’:
…/…/libraries/AP_Frsky_Telem/AP_Frsky_MAVliteMsgHandler.cpp:21:44: error: cannot bind packed field ‘mav_command_long.__mavlink_command_long_t::command’ to ‘uint16_t& {aka short unsigned int&}’
if (!rxmsg.get_uint16(mav_command_long.command, 0)) {
^
compilation terminated due to -Wfatal-errors.

Waf: Leaving directory `/home/pier/yaapu/ardupilot/build/KakuteF7’
Build failed
-> task in ‘objs/AP_Frsky_Telem’ failed (exit status 1):
{task 140460757332688: cxx AP_Frsky_MAVliteMsgHandler.cpp -> AP_Frsky_MAVliteMsgHandler.cpp.0.o}
(run with -v to display more information)
pier@pier-virtual-machine:~/yaapu/ardupilot$ git submodule update --init --recursive
fatal: Needed a single revision
Unable to find current revision in submodule path ‘modules/mavlink/pymavlink’
Failed to recurse into submodule path ‘modules/mavlink’
pier@pier-virtual-machine:~/yaapu/ardupilot$
pier@pier-virtual-machine:~/yaapu/ardupilot$ git status
On branch pr
Your branch is up to date with ‘origin/pr/crsf_telem_passthrough’.

nothing to commit, working tree clean
pier@pier-virtual-machine:~/yaapu/ardupilot$

@yaapu Compilation still has problems, is there any modification to mavlink?