MSP over Crossfire CRSF protocol
Current Behavior
Not implemented yet. Works fine in Betaflight
Desired Behavior
Add capability to Inav because INAV is the best :)
Suggested Solution
I copyed appropriate code to Inav and made custom exe for MatekF405 wing target, working fine. So copy and paste from Betaflight.(not so easy as there is few files to update and parameters, function to update).
Who does this impact? Who is this for?
Every one that run Inav + crossfire and openTX.
Additional context
Works fine with Inav 2.0 custom build + Matek F405Wing + Crossfire + Horus X10- OpenTx2.2.2 I managed to update a nice Widget (FrskyTelemetryScript from Yapuu) and convert it to use CRSF protocol. Picture of the original Widget below Also work with other scripts like betaflight-tx-lua-scripts, so you can setup VTX, PID etc.. over radio.
Looks nice on the radio screen and very nice to have when flying without FPV gear (ground station).
This issue / pull request has been automatically marked as stale because it has not had any activity in 60 days. The resources of the INAV team are limited, and so we are asking for your help. This issue / pull request will be closed if no further activity occurs within two weeks.
any news on this ?
It is working fine on my custom build. I did the mod as well for version 2.0.1 I don't know how to make pull request.
@digitalentity should be able to do that
@ZinhoRacing If you can't make a PR please post the files here we'll take care of it
@ZinhoRacing As I've been working with you on this, I'll be more than happy to help. Send me your changes and I'll take care of the PR.
@teckel12 , Hi, sorry had no time to clean and post the files. But I'll be more than happy if you can do the PR. Thank you. @shellixyz I'll do thanks and I'll need your point of view as well as I modified the osd.c/osd.h file to avoid duplicate code for CRSF telem FM (fly modes) and save some space (remove the static of Fly mode function to be accessible by telem/crsf.c code). I merged Teckel12 code (flight modes).
I should be able to work on it this week.
@teckel12, @shellixyz
Here is the files I modified to add MSP over CRSF protocol and to have all needed informations for telemetry scripts like Lua telemetry or Yapuu widget (on OpenTX radio), thanks to you Tecekl12 for the MSP telem idea. Tested OK on my configuration that is : Horus X10S / Open TX 2.2.2 / Inav 2.0.0 and 2.0.1 custom builds.
Minimum Files to update to have MSP over CRSF protocol working:
- fc/config.h
- rx/crsf.h
- rx/crsf.c
- telemetry/crsf.h
- telemetry/crsf.c
- telemetry/msp_shared.h All the modifications of that files are merge from betaflight code.
Additional files for telemetry scripts (perhaps will need a new issue):
- fc/fc_msp.c
- msp/msp_protocol.h
- io/osd.h
- io/osd.c
I hope it is clear, don't hesitate to ask me more explanation if needed. Thanks. fc.zip msp_protocol.zip rx.zip telemetry.zip io.zip
@ZinhoRacing I'll put together a PR for the MSP over Crossfire. The additional stuff for telemetry may not even be required once Horus and Crossfire support is added to LuaTelemetry, see:

@ZinhoRacing Sorry, your "Minimum Files" code wouldn't compile against the development branch without errors (which are a no-go). Are you getting ANY compile errors? If you are, they need to be resolved. Even if it creates the HEX, it's not acceptable for merging if there's errors.
The files I changed were:
- fc/config.h
- rx/crsf.h
- rx/crsf.c
- telemetry/crsf.h
- telemetry/crsf.c
- telemetry/msp_shared.h
And here's the compile output:
$ make TARGET=MATEKF722SE
settings.yaml -> settings_generated.h, settings_generated.c
%% debug.c
%% config_eeprom.c
%% pwm_output.c
%% cli.c
%% config.c
%% controlrate_profile.c
%% fc_core.c
./src/main/fc/fc_core.c: In function 'filterRc':
./src/main/fc/fc_core.c:647:57: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
biquadFilterInitLPF(&filteredCycleTimeState, 1, getLooptime());
^~~~~~~~~~~
%% fc_init.c
%% fc_tasks.c
./src/main/fc/fc_tasks.c: In function 'fcTasksInit':
./src/main/fc/fc_tasks.c:266:34: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
rescheduleTask(TASK_GYROPID, getLooptime());
^~~~~~~~~~~
%% fc_msp.c
%% fc_msp_box.c
%% rc_adjustments.c
%% rc_controls.c
%% rc_modes.c
%% settings.c
%% stats.c
%% failsafe.c
%% imu.c
%% mixer.c
%% pid.c
./src/main/flight/pid.c: In function 'pidInitFilters':
./src/main/flight/pid.c:219:34: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
const uint32_t refreshRate = getLooptime();
^~~~~~~~~~~
%% pid_autotune.c
%% rth_estimator.c
%% servos.c
%% wind_estimator.c
%% beeper.c
%% lights.c
%% pwmdriver_i2c.c
%% pwm.c
%% rx.c
%% spektrum.c
%% eleres.c
%% acceleration.c
%% battery.c
%% compass.c
%% diagnostics.c
%% gyro.c
./src/main/sensors/gyro.c: In function 'gyroInitFilters':
./src/main/sensors/gyro.c:313:94: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
biquadRCFIR2FilterInit(stage2Filter[axis], gyroConfig()->gyro_stage2_lowpass_hz, getLooptime());
^~~~~~~~~~~
%% initialisation.c
./src/main/sensors/initialisation.c: In function 'sensorsAutodetect':
./src/main/sensors/initialisation.c:54:13: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
accInit(getLooptime());
^~~~~~~~~~~
%% blackbox.c
./src/main/blackbox/blackbox.c: In function 'blackboxWriteSysinfo':
./src/main/blackbox/blackbox.c:1566:61: warning: implicit declaration of function 'getLooptime' [-Wimplicit-function-declaration]
BLACKBOX_PRINT_HEADER_LINE("looptime", "%d", getLooptime());
^~~~~~~~~~~
%% cms.c
%% cms_menu_battery.c
%% cms_menu_blackbox.c
%% cms_menu_imu.c
%% cms_menu_ledstrip.c
%% cms_menu_misc.c
%% cms_menu_navigation.c
%% cms_menu_osd.c
%% cms_menu_vtx_smartaudio.c
%% cms_menu_vtx_tramp.c
%% dashboard.c
%% gps.c
%% gps_ublox.c
%% gps_nmea.c
%% gps_naza.c
%% osd.c
%% navigation.c
%% navigation_fixedwing.c
%% navigation_fw_launch.c
%% navigation_geo.c
%% navigation_multicopter.c
%% navigation_pos_estimator.c
%% pitotmeter.c
%% rangefinder.c
%% opflow.c
%% crsf.c
%% frsky_d.c
%% ibus_shared.c
%% ibus.c
%% ltm.c
%% mavlink.c
%% smartport.c
%% telemetry.c
%% vtx.c
%% vtx_control.c
%% serial_softserial.c
Linking MATEKF722SE
Memory region Used Size Region Size %age Used
FLASH: 692 B 16 KB 4.22%
FLASH_CONFIG: 0 GB 16 KB 0.00%
FLASH1: 279280 B 480 KB 56.82%
TCM: 7764 B 64 KB 11.85%
RAM: 51676 B 192 KB 26.28%
MEMORY_B1: 0 GB 0 GB -1.#J%
arm-none-eabi-size ./obj/main/inav_MATEKF722SE.elf
text data bss dec hex filename
270712 9260 50176 330148 509a4 ./obj/main/inav_MATEKF722SE.elf
arm-none-eabi-objcopy -O ihex --set-start 0x8000000 obj/main/inav_MATEKF722SE.elf obj/inav_2.1.0_MATEKF722SE.hex
Maybe you were not using the development branch as the base? That's critical to be merged into the next release. Maybe you ignored the errors as it still "works"? In any case, I can't submit a PR if there's errors. I messed with it for a while but I didn't have time to do any further diagnosis as I was expecting more of an error-free compile.
BTW, the compile worked without errors before I added your files. Maybe you've merged some of the telemetry OSD stuff in these files?
Hi @teckel12, You right, I was not using the Dev branch sorry for that. I did the merge in my copy of 2.0.1 official code :( I have no warning or errors that's why I posted the files (of course I would not post code with errors or warning). I'll do it on Dev branch tonight and test it. It was not supposed to give you lot of work, sorry again. Now I know I need to work on dev branch if I want a change to be merged.
About LuaTelemetry it looks nice !!! I'll install it on my radio, I like the views.
It's totally fine, I was expecting a bit of work anyway. Sometimes, you won't see errors if the files with errors are already compiled. Try doing a clean build and see if you get any errors. For example:
make clean TARGET=NAME
I'll look at it again, I just didn't have time last night.
As far as Lua Telemetry goes, the Horus view is working in the horus branch. Crossfire support is still in the works, as it won't be possible till INAV 2.1 is released and the additional flight modes are added.
Ok, job done. I worked on Dev branch (2.1.0). Compilation is fine without errors. (I did make clean first) I flashed my matekF405SE (wing), I had to do some settings adjustment for new functionnalities (like braking stuf etc) as I had invalide setting flag ON, but after that all working fine with MSP over CRSF (tested over a script that allow to change PID / VTX setting with MSP commands). OSD files change is to avoid duplicate code for flight mode (using the same code in OSD and CRSF FM).
So files to update (only MSP over CRSF related) :
- fc/config.h
- io/osd.c
- io/osd.h
- rx/crsf.h
- rx/crsf.c
- telemetry/crsf.h
- telemetry/crsf.c
And here is 2 screen shoot (pictures took with my cell phone) of my radio (HorusX10) with LUA widget that use MSP data over CRSF link. One is displaying some data Inav configurator style. Other one is telemetry screen.

I think I'll want a merge of LuaTelemetry widget and my @yaapu custom widget :)
oooh now THATs purdy....
wonder if that could be run on a linux machine 😉 😉
@ZinhoRacing It seems the crsfFrameDeviceInfo function sends a lot of data without any real value. I'm concerned about sending too much information and slowing down the communication so I removed that.
I also removed the OSD code because doing it that way could slow things down more than speed them up or save memory.
@ZinhoRacing There's also a lot of code inside #if defined(USE_CRSF_CMS_TELEMETRY) pre-compile conditionals, yet USE_CRSF_CMS_TELEMETRY is not defined so none of it is actually compiling. I believe this code has to do with configuring settings via the OSD over Crossfire. But, this is never turned on anyway so it's also been deleted.
I believe you mean to say that you use the MATEKF405SE target? I've compiled it and you can test it here: inav_2.1.0_MATEKF405SE.hex.zip If this is the wrong target, let me know the target name and I'll compile it.
It's probably best to test the MSP with the betaflight-tx-lua-scripts. Keep in mind that the device info stuff was removed so we shouldn't expect that with this hex file.
The crsfFrameDeviceInfo function only send frame if requested by slave (master is FC and radio is slave). I tested it and it is working fine. It is part of native CRSF protocol (TBS). So I would be happy to leave it here. About USE_CRSF_CMS_TELEMETRY code, I left it here because it is not compiled as you said and it is comming from the betaflight file. I did more or less a merge/copy of betaflight code. I agree that can be removed. About OSD code ... I don't understand why it could slow down things ... and doing it that way we are sure to always have the same Inav Flight mode on OSD and on Inav CRSF telemetry if there is change or update of Inav flight modes. I would like to leave it. I'll test the Hex tonight. Thanks. Yes I have a MATEKF405 wing (target = MATEKF405SE). I'm using betaflight-tx-lua-scripts to test.
@ZinhoRacing I'll look into the crsfFrameDeviceInfo further, thanks.
If a user doesn't use an OSD it will need to run it anyway. OSD is also a resource pig, so avoiding it if not needed would be beneficial. The way to do it would be an external file that would be included by both OSD and Crossfire, but, there are slight differences, like spacing so maybe keeping them different isn't such a bad idea. If another developer objects, we could do the new included file method.