Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Background scanning Garmin GSC-10?

Rank

Total Posts: 14

Joined 2020-07-14

PM

Dear Members,
Can I use this for Garmin GSC-10 background scanning ?
https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_scanning.html
It's running on my terminal, but how can I see the value from Garmin GSC-10 ?

How can I run this function ?
/**@brief Process ANT message on ANT background scanning channel.
*
* @param[in] p_ant_evt ANT message content.
* @param[in] p_context Context.
*/
void background_scanner_process(ant_evt_t * p_ant_evt, void * p_context)
{
uint32_t err_code;
UNUSED_PARAMETER(p_context);
if (p_ant_evt->channel != ANT_BS_CHANNEL_NUMBER)
{
return;
}

switch (p_ant_evt->event)
{
case EVENT_RX:
{
err_code = bsp_indication_set(BSP_INDICATE_RCV_OK);
APP_ERROR_CHECK(err_code);

if (p_ant_evt->message.ANT_MESSAGE_stExtMesgBF.bANTDeviceID)
{
m_last_device_id = uint16_decode(p_ant_evt->message.ANT_MESSAGE_aucExtData);
}

if (p_ant_evt->message.ANT_MESSAGE_stExtMesgBF.bANTRssi)
{
m_last_rssi = p_ant_evt->message.ANT_MESSAGE_aucExtData[5];
}

NRF_LOG_INFO("Message number %d", m_recieved);
NRF_LOG_INFO("Device ID: %d", m_last_device_id);
NRF_LOG_INFO("RSSI: %d", m_last_rssi);

m_recieved++;
break;
}
default:
{
break;
}
}
}

Thanks      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_scanning.html shows that they have configured the RF channel to 2477 MHz and the network key to the public key. You would need to change these to the ANT+ network and channel.

If you want to receive only from the GSC-10 you will need to configure the device type to match the S&C profile. You can also wildcard (0) to receive data from all ANT+ sensors, and then parse the device type from the extended data. See the "ANT Message Protocol and Usage" document for more details on the extended data format.      

Signature

Ian Haigh

Rank

Total Posts: 14

Joined 2020-07-14

PM

haighi - 30 November 2020 10:46 AM
https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_scanning.html shows that they have configured the RF channel to 2477 MHz and the network key to the public key. You would need to change these to the ANT+ network and channel.

If you want to receive only from the GSC-10 you will need to configure the device type to match the S&C profile. You can also wildcard (0) to receive data from all ANT+ sensors, and then parse the device type from the extended data. See the "ANT Message Protocol and Usage" document for more details on the extended data format.


.................You would need to change these to the ANT+ network and channel.
How can I change it ? which file ?
What's the ANT+ configuration for Garmin GSC10 ?

Thanks      
Rank

Total Posts: 14

Joined 2020-07-14

PM

haighi - 30 November 2020 10:46 AM
https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_scanning.html shows that they have configured the RF channel to 2477 MHz and the network key to the public key. You would need to change these to the ANT+ network and channel.

If you want to receive only from the GSC-10 you will need to configure the device type to match the S&C profile. You can also wildcard (0) to receive data from all ANT+ sensors, and then parse the device type from the extended data. See the "ANT Message Protocol and Usage" document for more details on the extended data format.


These lines ?

const ant_channel_config_t ms_channel_config =
{
.channel_number = ANT_MS_CHANNEL_NUMBER,
.channel_type = CHANNEL_TYPE_MASTER,
.ext_assign = 0x00,
.rf_freq = RF_FREQ,
.transmission_type = CHAN_ID_TRANS_TYPE,
.device_type = CHAN_ID_DEV_TYPE,
.device_number = dev_num,
.channel_period = CHAN_PERIOD,
.network_number = ANT_NETWORK_NUM,
};

const ant_channel_config_t bs_channel_config =
{
.channel_number = ANT_BS_CHANNEL_NUMBER,
.channel_type = CHANNEL_TYPE_SLAVE,
.ext_assign = EXT_PARAM_ALWAYS_SEARCH,
.rf_freq = RF_FREQ,
.transmission_type = CHAN_ID_TRANS_TYPE,
.device_type = CHAN_ID_DEV_TYPE,
.device_number = 0x00, // Wild card
.channel_period = 0x00, // This is not taken into account.
.network_number = ANT_NETWORK_NUM,

What is the parameter for Garmin GSC10 ?

Thanks      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

The master channel in the example is setup b/c this is the use case for background scanning. Typically this would be used when multiple ANT+ profiles are used on a single device. The channel parameters for the master channel will not match S&C.

If you don't want to create a master channel for a profile, then you may want to use https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_controller.html instead to setup a continuous scanning channel.

If you just want to connect to a single sensor, then I suggest https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ant_examples_bicycle_spd_cad.html as the example you follow.

For the background scanning example:

In bs_channel_config you will need to set CHAN_ID_DEV_TYPE, CHAN_ID_TRANS_TYPE, and RF_FREQ to be the parameters for the S&C profile.

You will need to set the network key for the channel you choose to use as well. See "err_code = ant_plus_key_set(ANTPLUS_NETWORK_NUM);" in the BSC_RX example.

Note: you may need to modify the SDK to set the ANT+ network key properly "#define ANT_PLUS_NETWORK_KEY" in ant_key_manager_config.h. The network key is available at https://www.thisisant.com/developer/ant-plus/ant-plus-basics/network-keys      

Signature

Ian Haigh

Rank

Total Posts: 7

Joined 2020-10-13

PM

Hi Ian,
I have a little problem regarding "background scanning" example.

- Master = Nordic DK with ANT+ Tx profiles (e.g. HRM)
- Slave = Nordic DK with background scanning example

Parameters:
- RF = 57
- Trans type = 0 or 120 (e.g. HRM)
- Device type and channel as in datasheet

Results:
- when ANT_PLUS_NETWORK_KEY (master and slave) = 0, 0, 0, 0, 0, 0, 0, 0 it works
- when ANT_PLUS_NETWORK_KEY (master and slave) = 0xB9, ... it does NOT work
- With ANT_PLUS_NETWORK_KEY (master and slave) = 0xB9... my Garmin watch can detect Nordic DK simulator, when it is 0,... it can not (logical)

My question is what am I doing wrong, so when I am using correct ANT_PLUS_NETWORK_KEY, background scanning does not work (but it does with a public key)?
Thank you smile      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

Removed full key from your post b/c this is restricted information.

Note: transmission type 120 is not logical, think you are confusing with device type.

When I look at the background channel example it is not using the functions from ant_key_manager.c, so changes to ANT_PLUS_NETWORK_KEY will not be picked up by it. It doesn't look to set the network key.      

Signature

Ian Haigh

Rank

Total Posts: 7

Joined 2020-10-13

PM

Sorry for the key and yes I did mean Device type as 120.

I did assume that only ANT+ device would use that key, but like I did mention when changing that key, it effects if it works or not.

When on "0" it can detect any simulation ANT+ on Nordic Dk (HRM, BSC;...) with key = 0, but when changed to 0xB9,... it stops working.
As well When Background scanning is set to "0" and ANT+ simulators are set to 0xB9,... it does not work. Same result if I use a real ANT+ sensors.

I will try "continuous scanning" example as well. If there is some other suggestion regarding that issues I will appreciate. Thank you.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

"When on "0" it can detect any simulation ANT+ on Nordic Dk (HRM, BSC;...) with key = 0, but when changed to 0xB9,... it stops working." This is because the all 0 key matches the behavior of not setting the key. If you want background scan to work on the ANT+ network, you need to add setting the network key.      

Signature

Ian Haigh

Rank

Total Posts: 7

Joined 2020-10-13

PM

Hi Haigh,

thank you for your support, it works now with sd_ant_network_address_set()      
Rank

Total Posts: 3

Joined 2023-04-12

PM

It's hard to understand. Why doesn't it work for me?

krunker