Garmin device 820 doesn't comunicate with ANT device (simulator does)

Former Member
Former Member
Hello all. I'm writing a Datafield for a client of mine and I've been testing it on the simulator. All is well, i can comunicate with their ANT device and send data to the device. When i test it on the device (Garmin 820) there's no comunication at all with the ANT device. Is there any way I can debug this? Am i missing any settings (on the device) or something I don't know?

As documentation says, "ANT is not available for watch faces" but i'm not doing a watch face

https://developer.garmin.com/connect-iq/programmers-guide/positioning-sensors/#genericantchannels
  • Former Member
    Former Member
    The Edge 820 should be able to communicate with an ANT device without any real issue. Can you give us any snippits of code so we can try and help you see what's going on? If it is working in the sim, then we might have a bug in the device implementation or in the sim. My initial guess is that it has something to do with the type of pairing. You are doing. Some sensors must be paired through the native system pairing process for a device first before you are given access. Some will connect directly with an app. We would really need to see some of the code and get some more info about the issue to diagnose it.

    Thanks,
    -Coleman
  • Former Member
    Former Member
    The Edge 820 should be able to communicate with an ANT device without any real issue. Can you give us any snippits of code so we can try and help you see what's going on? If it is working in the sim, then we might have a bug in the device implementation or in the sim. My initial guess is that it has something to do with the type of pairing. You are doing.


    No pairing is needed for this device (custom hardware). I tested the firmware with the ANTWareII application.


    Some sensors must be paired through the native system pairing process for a device first before you are given access. Some will connect directly with an app. We would really need to see some of the code and get some more info about the issue to diagnose it.

    Thanks,
    -Coleman


    Here is the part where i setup the ANT connection

    mView = view;

    chanAssign = new Ant.ChannelAssignment(Ant.CHANNEL_TYPE_TX_NOT_RX, Ant.NETWORK_PRIVATE);
    GenericChannel.initialize(method(:onMessageReceived), chanAssign);

    // setup ant configuration
    antDeviceConfig = new Ant.DeviceConfig({
    : deviceNumber => 0,
    : deviceType => DEVICE_TYPE,
    : transmissionType => 1,
    : messagePeriod => 3276,
    : radioFrequency => 66,
    : searchTimeroutLowPriority => 2, // measured in 2.5s increments. So it's 25 seconds
    : searchTimeroutHighPriority => 2,
    : searchThreshhold => 0
    });

    // and set it
    GenericChannel.setDeviceConfig(antDeviceConfig);

    System.println("SENSOR INITIALIZED");
  • Former Member
    Former Member
    https://pastebin.com/6dpAkVdK

    sorry for the pastebin but the forum didn't allow me to post my code
  • Are you opening the sensor channel with a GenericChannel.Open()?

    You might try setting the Low Priority Search Timeout to 10 and the High Priority Search Timeout to 0. There have been some issues with that in the past. I can't find the posts right now though.

    There also used to be problems if you had a large number of devices setup natively on the device. For example if you had 5 heart rate sensors paired natively. They would not need to actually be connected. Just having them listed in the sensors list would cause the problem. Removing all sensors of all types from the sensors list on the native part of the device would eliminate this problem. I don't know if this has been fixed or not.
  • Former Member
    Former Member
    Are you opening the sensor channel with a GenericChannel.Open()?

    You might try setting the Low Priority Search Timeout to 10 and the High Priority Search Timeout to 0. There have been some issues with that in the past. I can't find the posts right now though.

    There also used to be problems if you had a large number of devices setup natively on the device. For example if you had 5 heart rate sensors paired natively. They would not need to actually be connected. Just having them listed in the sensors list would cause the problem. Removing all sensors of all types from the sensors list on the native part of the device would eliminate this problem. I don't know if this has been fixed or not.


    Yes, in the paste you can see in the second snippet that i call "GenericChannel.Open()". I'll try incrementing the timeouts and see what happens
  • Couple questions/points:

    1) In your channel assignment you are setting your channel type as "CHANNEL_TYPE_TX_NOT_RX". This means that your Data Field will be a master (primarily transmitting data to a receiving device). Is this desired? (If you are trying to connect to a sensor you'll need to change your channel type to RX_NOT_TX).

    2) In your channel assignment you specify a private network but are not passing the 64-bit and 128-bit network keys into the device configuration. You'll need to specify the same network key as used by device you are trying connect to. If it's not a private network, I recommend switching it to the PUBLIC key if you wish to remain a transmitter. Use ANT_PLUS if you are trying to connect to an ANT+ sensor.

    3) In your device configuration, you are setting the device number to 0. This is not good to do as your channel assignment specifies your data field as a master. Master channels in ANT need to specify a device number so the slaves can uniquely identify masters to connect to.

    4) Your likely setting the broadcast buffer too early. You want to set the broadcast buffer after you receive the channel open response in your message handler. Otherwise you could be trying to set the broadcast buffer before the channel is opened. This will lead to your sendBroadcast() command being ignored.
  • Former Member
    Former Member
    @MoxyRoger: changing the timeouts didn't help


    1 -No, i need the channel to be master (as specifics from client).
    2 - No, the device is not ANT+, but only ANT
    3 - Again, as specifics, this needs to be set to 0
    4 - Doing that but it doesn't solve the issue of the garmin 820 not being able to talk to the ANT device while the simulator can

    (@moderators: took me 20minutes to post this.)
  • Former Member
    Former Member
    Solved the issue. Looks like the connection to the device was failing the first time (don't know why) so I simply added a retry on fail. Now all works as intended