This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

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

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);

  1. 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

Related