Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Heart Rate Monitor → Thread

   

what is the proper sequence of open and reopen a ANT+ Channel ?

Rank

Total Posts: 6

Joined 2013-06-30

PM

HI Everybody,

I am developing firmware for handling multiple ANT+ Sensors. i am able to collect data from 3 different sensors, but in below scenario am getting channel in wrong state error.
A) I opened 2 sensor channel 0 and channel 1 and started collecting data . working fine.
B) Now i close the channel 1 and get success in it.
C) Channel 0 still working.
4) after this , i tried to open the channel 1 again, but find out the channel 1 in wrong state on the belwo line of code.

/* Set Channel Number */
return_value = sd_ant_channel_assign(SDM_CHANNEL_1,
CHANNEL_TYPE_SLAVE,
SDM_NETWORK_0,
SDM_CHANNEL_0_ANT_EXT_ASSIGN);


5) here i get the "NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE" issue. this also stop my channel 0 as well.

Here is the steps , which i follow for channel close .
1. close channel.
2) unassign channel .

retrunvalue =sd_ant_channel_close(chan);
if (NRF_SUCCESS == retrunvalue){

for(k=0;k<100;k++);
retrunvalue = sd_ant_channel_unassign(chan);
if (NRF_SUCCESS == retrunvalue){
-----

}else{
---
}


return NRF_SUCCESS;
}

is this the proper way to close a channel or i have to do any extra step ?
or any specific document or reference which explain this procedure ?

Note : I am using Channel 0 for HRM and channel 1 for SDM sensor fixed in my firmware.

thanks in advance
Robin Singh      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

There are 2 pair of reciprocal methods on channels:
* assign - unassign
* open - close

So the proper sequence is:
1. assign, open, close ..... open, close, and so on
2. assign, open, close, unassign .... assign, open, and so on

1. applies if the 2nd open shall use the same channel parameters, i.e. you want to connect to the same device (type)
2. applies if you try to build up a different connection

Cheers,
OMB      
Rank

Total Posts: 6

Joined 2013-06-30

PM

thank you , its working for me now, i used the first method.