Problem with Generic ANT Recovering from a Timeout

I'm having an issue with the Generic ANT Channel recovering from a timeout.

I've had this issue reported on the released version of the MoxyRun App running on a Fenix 3. I think I've reproduced the issue on a VivoActive, but I'm not certain this is the same issue as reported.

The problem only occurs once in a while, not every time. It seems like it will happen 5 times in a row and then I can't make it happen at all for many tries in a row.

To cause the problem:
1) Open the App
2) Do not turn on the Moxy sensor, but wait for the searching to time out ( > 25 seconds...I don't push a timeout message, but I should add that)
3) Turn the Moxy sensor on
4) Press the menu button and select Pair to Moxy sensor.

Most of the time it pairs just fine and continues to function properly.

Sometimes it won't find the Moxy sitting right next to the watch. If I back out of the searching view and then select pair to a Moxy sensor again, it will usually find the Moxy sensor. Sometimes this takes 2 or 3 tries. Once it finds the Moxy, I go back to the main screen and the SmO2 and THb values are frozen at a certain value. Everything else in the App works fine.

I added in some println's to capture what's going on when it fails like this.

function onMessage(msg) {

// Parse the payload
var payload = msg.getPayload();
Sys.println("Time: " + Sys.getClockTime().hour + ":" + Sys.getClockTime().min + ":" + Sys.getClockTime().sec + " msgId: " + msg.messageId.toNumber());
for (var i = 0; i < 2; i++) {
Sys.println("p" + i + " " + (payload.toNumber() & 0xFF));
}
if (Ant.MSG_ID_BROADCAST_DATA == msg.messageId) {
[/CODE]

Below is the output that I get from the printlns. I added in the text that says what each event message is afterwards.

Everything looks fine up through the "EVENT_RX_SEARCH_TIMEOUT" message. When I tried again to pair at about 7:51:17, I should have had a very similar series of messages again, but instead, I got 1 close message, then 1 broadcast message, then 1 close message.

I don't know where the close message is coming from. I don't think I'm sending it.

It showed on the screen that it actually paired to the sensor so I'm assuming that the values in the 1 broadcast message are the values that were frozen on the screen, but I didn't print the whole message, so I don't know for sure.

Any ideas on what I need to do differently to get this to function properly? Is this related to the issues that the Tempe app had with pairing? I can send the code in if needed.


Time: 7:46:15 msgId: 64
p0 110 Lib Config
p1 0
Time: 7:46:16 msgId: 64
p0 65 Unassign Channel
p1 0
Time: 7:46:17 msgId: 64
p0 66 Assign Channel
p1 0
Time: 7:46:18 msgId: 64
p0 81 Channel ID
p1 0
Time: 7:46:18 msgId: 64
p0 69 Channel RF Freq
p1 0
Time: 7:46:19 msgId: 64
p0 67 Channel Period
p1 0
Time: 7:46:20 msgId: 64
p0 99 Low Priority Search Timeout
p1 0
Time: 7:46:20 msgId: 64
p0 68 Search Timeout
p1 0
Time: 7:46:21 msgId: 64
p0 71 Transmit Power
p1 0
Time: 7:46:28 msgId: 64
p0 71 Transmit Power
p1 0
Time: 7:46:34 msgId: 64
p0 71 Transmit Power
p1 0
Time: 7:46:40 msgId: 64
p0 71 Transmit Power
p1 0
Time: 7:46:45 msgId: 64
p0 1
p1 1 EVENT_RX_SEARCH_TIMEOUT
Time: 7:51:17 msgId: 64
p0 76 Close Channel
p1 0
Time: 7:51:53 msgId: 78
p0 1 Broadcast Data
p1 221
Time: 7:51:53 msgId: 64
p0 76 Close Channel
p1 0
  • The failure sequence of ANT messages isn't always exactly the same. This one is just a bit different.

    Time: 9:22:26 msgId: 64
    p0 110 Lib Config
    p1 0
    Time: 9:22:27 msgId: 64
    p0 65 Unassign Channel
    p1 0
    Time: 9:22:27 msgId: 64
    p0 66 Assign Channel
    p1 0
    Time: 9:22:28 msgId: 64
    p0 81 Channel ID
    p1 0
    Time: 9:22:29 msgId: 64
    p0 69 Channel RF Freq
    p1 0
    Time: 9:22:29 msgId: 64
    p0 67 Channel Period
    p1 0
    Time: 9:22:30 msgId: 64
    p0 99 Low Priority Search Timeout
    p1 0
    Time: 9:22:31 msgId: 64
    p0 68 Search Timeout
    p1 0
    Time: 9:22:32 msgId: 64
    p0 71 Transmit Power
    p1 0
    Time: 9:22:38 msgId: 64
    p0 71 Transmit Power
    p1 0
    Time: 9:22:44 msgId: 64
    p0 71 Transmit Power
    p1 0
    Time: 9:22:51 msgId: 64
    p0 71 Transmit Power
    p1 0
    Time: 9:22:56 msgId: 64
    p0 1
    p1 1 EVENT_RX_SEARCH_TIMEOUT
    Time: 9:40:42 msgId: 78
    p0 1 Broadcast Data
    p1 99
    Time: 9:40:43 msgId: 64
    p0 76 Close Channel
    p1 0
  • Thanks, Roger. We'll get this investigated.
  • FYI - Here's the printout from the simulator where everything works properly. I'm doing the same sequence of opening the App, letting the search timeout, going to the menu and selecting to pair to a new Moxy.

    Time: 11:3:39 msgId: 64
    p0 110
    p1 0
    Time: 11:3:39 msgId: 64
    p0 65
    p1 21 <-- This Byte is different???
    Time: 11:3:39 msgId: 64
    p0 66
    p1 0
    Time: 11:3:39 msgId: 64
    p0 81
    p1 0
    Time: 11:3:39 msgId: 64
    p0 69
    p1 0
    Time: 11:3:39 msgId: 64
    p0 67
    p1 0
    Time: 11:3:39 msgId: 64
    p0 99
    p1 0
    Time: 11:3:39 msgId: 64
    p0 68
    p1 0
    Time: 11:4:9 msgId: 64
    p0 1
    p1 1 EVENT_RX_SEARCH_TIMEOUT
    Time: 11:15:10 msgId: 64
    p0 65
    p1 21 <-- This Byte is different???
    Time: 11:15:10 msgId: 64
    p0 66
    p1 0
    Time: 11:15:10 msgId: 64
    p0 81
    p1 0
    Time: 11:15:10 msgId: 64
    p0 69
    p1 0
    Time: 11:15:10 msgId: 64
    p0 67
    p1 0
    Time: 11:15:10 msgId: 64
    p0 99
    p1 0
    Time: 11:15:10 msgId: 64
    p0 68
    p1 0
    Time: 11:15:10 msgId: 64
    p0 113
    p1 0
    Time: 11:15:11 msgId: 78
    p0 1
    p1 4
    Time: 11:15:11 msgId: 78
    p0 1
    p1 4
    Time: 11:15:11 msgId: 64
    p0 1
    p1 5
    Time: 11:15:12 msgId: 78
    p0 1
    p1 4
    Time: 11:15:12 msgId: 78
    p0 1
    p1 4
  • Former Member
    Former Member
    Are you changing the ant searchThreshold value at any point? I find any value other than 0 to be problematic. I should add that I have not altered this value for months, so have not tested for multiple recent CIQ versions.
  • This all sounds just like what the garmin developer of the Tempe app is dealing with when trying to use the ant+ interface

    https://forums.garmin.com/showthread.php?217692-Garmin-TempeVersion-1-0-Connect-IQ

    I'm on a vivoactive which has native support for the Tempe, but even then I do see the ant+ crash file at times with my app that uses it as a native sensor.

    I'd suspect something "not quite right" in ANT+ on some devices, and based on the release of SDK 1.2.0 and the ant+ conference, maybe fixes are coming...

    From the Garmin Developer Blog:

    We are very excited about our upcoming 1.2.0 release which will improve connectivity, allow users to edit app settings in Garmin ConnectTm Mobile and Garmin Express, and others new features. Connect IQ 1.2.0 will be in late September… hey, wait a minute, that is around the time of ANT+ Symposium! The Connect IQ Monkeys will be there to give technical talks about Connect IQ. Come join us, won’t you?
  • Former Member
    Former Member
    A quick read reveals he was (initially at least) using a searchThreshold not equal to 0. I would have predicted his problems. Another solution to proximity pairing would be the ANT+ inclusion/exclusion lists, as a way to handle device selection when multiple sensors are present.
  • A quick read reveals he was (initially at least) using a searchThreshold not equal to 0. I would have predicted his problems. Another solution to proximity pairing would be the ANT+ inclusion/exclusion lists, as a way to handle device selection when multiple sensors are present.


    He's also with Garmin and probably has better access to the ANT+ folks than anyone here, and the Tempe app still isn't working it seems...
  • A quick read reveals he was (initially at least) using a searchThreshold not equal to 0. I would have predicted his problems. Another solution to proximity pairing would be the ANT+ inclusion/exclusion lists, as a way to handle device selection when multiple sensors are present.


    Hi Sharkbait,

    Thanks for the idea. I was using search threshold 0 when the sensor number is known (when I start the app, I read the last paired sensor number from the object store) I was using search threshold 4 when doing an open search for a new sensor.

    I changed to use SearchThreshold 0 all of the time and I still get the exact same problem.
  • Former Member
    Former Member
    Ok. I skimmed the info on first read. A closer look, and it appears to me your channel isn't being closed instantly after a search timeout. I personally close and reopen the ant channel after receiving MSG_CODE_EVENT_RX_SEARCH_TIMEOUT. I can't remember back, and my notes are somewhat non-existent, but I usually have a method to my madness.
  • Former Member
    Former Member
    FYI.....
    else if( Ant.MSG_ID_CHANNEL_RESPONSE_EVENT == msg.messageId ) {
    var event = payload[1].toNumber();
    if( Ant.MSG_CODE_EVENT_RX_FAIL == event ) {
    isStrapRx = false;
    isPulseRx = false;
    }
    else if( Ant.MSG_CODE_EVENT_RX_FAIL_GO_TO_SEARCH == event ) {
    isAntRx = false;
    }
    else if( Ant.MSG_CODE_EVENT_RX_SEARCH_TIMEOUT == event ) {
    closeCh();
    openCh();
    }
    }
    }


    function openCh() {
    // Get the channel
    var chanAssign = new Ant.ChannelAssignment(
    Ant.CHANNEL_TYPE_RX_NOT_TX,
    Ant.NETWORK_PLUS);


    // Set the configuration
    var deviceCfg = new Ant.DeviceConfig( {
    :deviceNumber => 0,
    :deviceType => 120,
    :transmissionType => 0,
    :messagePeriod => 8070,
    :radioFrequency => 57,
    :searchTimeoutLowPriority => 2,
    :searchTimeoutHighPriority => 2,
    :searchThreshold => 0} );


    antCh = new Ant.GenericChannel(method(:onAntMsg), chanAssign);
    antCh.setDeviceConfig(deviceCfg);
    isChOpen = antCh.open();
    }


    // Close Ant channel.
    function closeCh() {
    if(isChOpen) {
    antCh.release();
    }
    isChOpen = false;
    isAntRx = false;
    isStrapRx = false;
    isPulseRx = false;
    }