Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

ANT+ Proximity search, change device

Hello everyone,

I am trying to use the S340 softdevice in order to connect to an ANT+ HR. I would like to use proximity search.

It works fine for the first device in range but afterwards I am not able to change to another hr sensor. I can only reconnect to the same device...

here is the relevant code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void ANT_Init() {
uint32_t err_code = nrf_sdh_ant_enable();
APP_ERROR_CHECK(err_code);
err_code = ant_plus_key_set(ANTPLUS_NETWORK_NUMBER);
APP_ERROR_CHECK(err_code);
/* Set library config to report RSSI and Device ID */
err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI | ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
APP_ERROR_CHECK(err_code);
// Register a handler for ANT events.
NRF_SDH_ANT_OBSERVER(m_ant_observer, APP_ANT_OBSERVER_PRIO, ant_evt_handler, NULL);
// Initialize ANT+ HRM receive channel.
err_code = ant_hrm_disp_init(&m_ant_hrm,
HRM_DISP_CHANNEL_CONFIG(m_ant_hrm),
ant_hrm_evt_handler);
APP_ERROR_CHECK(err_code);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

My guess is that the softdevice stores the device number once it gets connected and after closing connection and starting proximity search again it only allows this device number?

So I tried to close the channel and reintit but I get error 0x4015 (wrong state) even after unassigning it.

Thanks for any help!

Andreas

How can I reset this?