MAVLink data not sent to MinimOSD unless REQUEST_DATA_STREAM

APM 2.6, Arducopter 3.2.1
I am having an issue that data is not sent to the MinimOSD UNTIL I connect via the telemetry radio.
Thereafter everything works fine.

Note that all SR0_* and SR1_* parameters are set to non-zero values.

I wrote a MAVlink inspector using an Arduino Due, and saw the following:

  1. The APM only emits heartbeat messages initially
  2. Once the telemetry radio connects, it sends a REQUEST_DATA_STREAM message (two of them actually)
  3. Then all MAVlink message start up, and the OSD works 100%

This is a problem because the MinimOSD Tx is not connected (in order to allow the telemetry radio to work), so it cannot send a REQUEST_DATA_STREAM message.

Additionally, I am not sure that the MinimOSD send this message anyway.

Here is the output from the inspector. The first number is seconds elapsed, and the > or < indicates direction of the message.

==== Opening MAV 1…
==== Opening MAV 2…
0 > 0 (1, 1) > HEARTBEAT
1 > 0 (1, 1) > HEARTBEAT

26 > 0 (1, 1) > HEARTBEAT
27 > 0 (1, 1) > HEARTBEAT
27 < 0 (255, 190) < HEARTBEAT
27 < 66 (255, 190) < REQUEST_DATA_STREAM
27 < 66 (255, 190) < REQUEST_DATA_STREAM
27 > 42 (1, 1) > MISSION_CURRENT
27 > 35 (1, 1) > RC_CHANNELS_RAW
27 > 30 (1, 1) > ATTITUDE
27 > 74 (1, 1) > VFR_HUD
27 > 2 (1, 1) > SYSTEM_TIME
27 > 253 (1, 1) > STATUSTEXT
27 > 22 (1, 1) > PARAM_VALUE

33 > 22 (1, 1) > PARAM_VALUE
33 > 22 (1, 1) > PARAM_VALUE
34 > 22 (1, 1) > PARAM_VALUE
34 > 1 (1, 1) > SYS_STATUS
34 > 42 (1, 1) > MISSION_CURRENT
34 > 24 (1, 1) > GPS_RAW_INT
34 > 62 (1, 1) > NAV_CONTROLLER_OUTPUT
34 > 0 (1, 1) > HEARTBEAT
34 > 27 (1, 1) > RAW_IMU
34 > 29 (1, 1) > SCALED_PRESSURE
34 > 33 (1, 1) > GLOBAL_POSITION_INT
34 > 36 (1, 1) > SERVO_OUTPUT_RAW
34 > 35 (1, 1) > RC_CHANNELS_RAW
34 > 30 (1, 1) > ATTITUDE

PS: I did post this a while ago on GitHub as an issue, but it was closed
github.com/diydrones/ardupilot/issues/3239

Can you share your “inspector” code?
I can not get data from telemetry port
arduino rx0 connect to telemetry tx pin,
then Serial.begin(57600);
Then Serial.availabe() never >0,

Correct, the later version of minim OSD do not set the Mavlink data stream. You need to do this manually through Mission Planner. These are the settings:

MAV_DATA_STREAM_RAW_SENSORS = 2 //SR2_RAW_SENS
MAV_DATA_STREAM_EXTENDED_STATUS = 2 //SR2_EXT_STAT
MAV_DATA_STREAM_RC_CHANNELS = 5 //SR2_RC_CHAN
MAV_DATA_STREAM_POSITION = 2 //SR2_POSITION
MAV_DATA_STREAM_EXTRA1 = 5 //SR2_EXTRA1
MAV_DATA_STREAM_EXTRA2 = 2 //SR2_EXTRA2

This is if your using Telem 2 as your output.

Mike

Did you connect the ground of the Arduino to the APM ground?

Also, is rx0 in use by the USB port when you test?

[quote=“wilsonchang”]Can you share your “inspector” code?
I can not get data from telemetry port
arduino rx0 connect to telemetry tx pin,
then Serial.begin(57600);
Then Serial.availabe() never >0,[/quote]

Thanks for the ideas Mike. A few points:

  1. There are no MAV_DATA_ parameters in my Copter 3.2.1

  2. I did set the SR0 and SR1 parameters as indicated in the OP.

  3. There is no Telem 2 on my APM 2.6

[quote=“iseries”]Correct, the later version of minim OSD do not set the Mavlink data stream. You need to do this manually through Mission Planner. These are the settings:

MAV_DATA_STREAM_RAW_SENSORS = 2 //SR2_RAW_SENS
MAV_DATA_STREAM_EXTENDED_STATUS = 2 //SR2_EXT_STAT
MAV_DATA_STREAM_RC_CHANNELS = 5 //SR2_RC_CHAN
MAV_DATA_STREAM_POSITION = 2 //SR2_POSITION
MAV_DATA_STREAM_EXTRA1 = 5 //SR2_EXTRA1
MAV_DATA_STREAM_EXTRA2 = 2 //SR2_EXTRA2

This is if your using Telem 2 as your output.

Mike[/quote]

Right, So you have to use a Y cable from Telem1 then. This port should already be setup correctly as it is used by the GCS.

SR1_RAW_SENS = 2
SR1_EXT_STAT = 2
SR1_RC_CHAN = 5
SR1_POSITION = 2
SR1_EXTRA1 = 5
SR1_EXTRA2 = 2

Mike

Thank you two guys!
I did connect the apm and arduino ground actually vcc also, i feed the apm 5v from pwm output side, arduino get power from telemetry port.
WHEN I CONNECT an osd board onto the same telemetry port, which is aslo only using 4 pins with osd tx open, the osd can start connection with aps.

Sorry osd is using 3 pins, vcc,gnd, rx to apm telemetry tx

Thanks again for a reply Mike. I do of course have a Y cable, otherwise the telemetry radio and the MinimOSD would never work. As in the OP, the telemtry radio works 100%, and once the REQUEST_DATA_STREAM message is sent by the radio, the MininOSD then works 100%

This is not a cabling issue. It is an issue about MAV data not being sent automatically by APM. It is only sent after a REQUEST_DATA_STREAM.

Also, as posted before, I do have SR1_* set. As follows:
SR1_EXTRA1,2
SR1_EXTRA2,5
SR1_EXTRA3,1
SR1_EXT_STAT,1
SR1_PARAMS,1
SR1_POSITION,5
SR1_RAW_CTRL,2
SR1_RAW_SENS,1
SR1_RC_CHAN,1

[quote=“iseries”]Right, So you have to use a Y cable from Telem1 then. This port should already be setup correctly as it is used by the GCS.

SR1_RAW_SENS = 2
SR1_EXT_STAT = 2
SR1_RC_CHAN = 5
SR1_POSITION = 2
SR1_EXTRA1 = 5
SR1_EXTRA2 = 2

Mike[/quote]

Hello Peebee, do you already have a solution?
Can you share your code With Send stream request…
Again why i cant serial.read() data with arduino nano rx pin connecting apm teleport tx pin,serial.begin(57600) ? Encoded?

Hello Peebee, do you already have a solution?
Can you share your code With Send stream request…
Again why i cant serial.read() data with arduino nano rx pin connecting apm teleport tx pin,serial.begin(57600) ? Encoded?

Eventually got this working. It seemed easier to modify the MinimOSD code, than to try fix and recompile the bad APM code. First had to get minimosd-extra prerelease working on Arduino IDE 1.6. That was mainly just changing prog_char to char using a #define. Next was changing the MinimOSD code so that it listened for the first heartbeart from the APM, picked up the IDs from that, and then sent REQUEST_DATA-STREAM with the appropriate component id. Most of that code was already there, but commented out for some reason. Finallly, a physical switch was installed on the quad which connects the Rx from the APM to EITHER the telemetry radio OR the MinimOSD.

The code is suppose to start that up for you but I found in 3.2.1 that sometimes the serial port didn’t start. After rebooting several times it does start up. On the new version 3.3. the serial port start right up with no issues.

While I am not using a minumOSD board I do have a micro controller connect that changes the LED’s on the copter based on Mavlink data. It works every time now and I even put code in to monitor the port and tell me if it didn’t start up for the older versions that I now don’t need.

With APM2 boards you don’t have a choice.

The serial port does start, as is apparent from the heartbeats received in the log in the OP.

I flew the quad for several months with this issue in place, and it never once just worked irrespective of the number of reboots.

Earlier Arducopter versions did start the stream without the need for REQUEST_DATA_STREAM, but 3.2.1 is the latest for APM, and that is stuck with the issue.

Perhaps it was done to make the code more efficient, i.e. no wasted time sending data streams if nobody is listening.

Right, but you have the option to turn that off on the parameter screen so don’t see the need. This is a question for the developers to answer.

Also I thought telem1 on APM2 boards was turned on by default.

Mike

Good point.

I did raise it on GitHub https://github.com/ArduPilot/ardupilot/issues/3239 and again https://github.com/ArduPilot/ardupilot/issues/3884 but it didn’t get a very warm reception.

There is only one Telem port on APM2.6 and it was on by default at some version of ArduCopter. The latest available code for APM2.6 is 3.2.1 and it does not send telemetry data by default.

An extra twist - this may be an APM Planner issue. When I connected via APMPlanner, the SR0 parameter were all non-zero. When I connected vie a telemetry radio and Tower on Android, some SR parameters were zero. I made them non zero via Tower, and now the data streams start up automatically on boot up.

Perhaps APMPlanner sets the data rates temporarily, and so somehow does not save them when you write parameters?