I just bought an FrSky Taranis for my quad copter and needed to get the Mavlink data up on the Taranis LCD telemetry display. So here is my solution using a Teensy3.1 as a converter between MavLink and the S.Port on FrSky X8R.
See attached file below...
Its an Arm M4 https://www.pjrc.com/teensy/teensy31.html
It's the signal thats 3.3V
quick FYI/watch out... if you wire all of your telemetry together on one RX bus (teensy, MinimOSD + wireless telemetry) be careful when plugging in the minimosd... I hit the wrong pins and fried my teensy.. another is on order now!
While this was working (pre plugging mistake) I did find however that Minim OSD wasnt picking up an RSSI signal, I presume this should be X8R>Pixhawk (over S-bus). Any ideas how this should work?
do you know how to get the 8 RC_in channels from the Mavlink data?
I followed your instructions, but always get errors compiling. I have also tried adding the AP_HAL and GCS_MAVLink libraries manually into the libraries folder and including it. Always get errors, such as
MavLink_FrSkySPort.ino: In function 'void setup()':
MavLink_FrSkySPort:122: error: 'Serial2' was not declared in this scope
MavLink_FrSkySPort.ino: In function 'void loop()':
MavLink_FrSkySPort:150: error: 'Serial2' was not declared in this scope
MavLink_FrSkySPort.ino: In function 'void _MavLink_receive()':
MavLink_FrSkySPort:188: error: 'Serial2' was not declared in this scope
FrSkySPort.ino: In function 'void FrSkySPort_Init()':
FrSkySPort:19: error: 'Serial1' was not declared in this scope
FrSkySPort:20: error: 'UART0_C3' was not declared in this scope
I have no idea what I am doing wrong. I am surprised no one else had the issues compiling. Any help would be greatly appreciated.
Thanks again for this great code.
I got the flight mode to be sent down via your suggestion. Thanks for the info. Right now I am sending the mode down as the fuel telemetry value. Is there are more appropriate value to send it down as? Where did you get the values for the FrSky DATA ID's.
mavlink_msg_request_data_stream_pack(0xFF,0xBE,&msg,1,1,MAV_DATA_STREAM_EXTENDED_STATUS, MSG_RATE, START);
Those commands in MavLink_FrSkySPort.ino request the different types of data. The contents of the requested messages are defined in libraries\GCS_MAVLink\include\mavlink\v1.0\common\common.h
You probably want this message:
MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */
I think I had that issue at first. Make sure you have the board set to Teensy 3.1. In the Arduino applications go to tools->board and select Teensy 3.1. You may even have to restart to get it to work
Thank you Kent. That worked!!!
Kent, Do you know the exact syntax, so I can put it in MavLink_FrSkySPort.ino?
Hi Peter. I was showing you generally how to do what you would need to do. Much more has to happen in the code for it to do what you want. When the message you are after comes back you have to then direct the pertinent data to the FrSky port in the proper way. The best way is to jump in and figure it out. C is not terribly hard and there is plenty of help out on the internet and here.