Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Data exchange with master when slaves are already ON

Rank

Total Posts: 16

Joined 2020-10-16

PM

Hello,

We have a master and several slaves setup in a simple master/slave channel configuration.

It seems like the master must be in powered-ON state while slaves connect with it. I have been seeing situations where, in case, master is turned ON while slaves were already ON, they don't exchange data. As soon as slaves are power cycled, they start getting data from the master (a constant 1s ping).

How to cop with such a situation? In our application we don't have control over when a user turns on/off the master or a slave device.

Thanks.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

How are you configuring your slave channel for search timeout? If you have not set an extremely long timeout, then you are probably getting a search timeout before turning on the master. Try lengthening the timeout, or reopening the channel in response to the search timeout.      

Signature

Ian Haigh

Rank

Total Posts: 16

Joined 2020-10-16

PM

Hi,

Thanks for the reply.

I'm trying to set the channel search timeout to unlimited/infinite.
static void ant_channel_rx_broadcast_setup(void)
{
    
// Configure extended mode, include RSSI
    //ret_code_t err_code = sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI | ANT_LIB_CONFIG_MESG_OUT_INC_TIME_STAMP);
    
ret_code_t err_code sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI);
    
APP_ERROR_CHECK(err_code);

    
ant_channel_config_t broadcast_channel_config =
    
{
        
.channel_number    BROADCAST_CHANNEL_NUMBER,
        .
channel_type      CHANNEL_TYPE_SLAVE,
        
//.channel_type      = CHANNEL_TYPE_SHARED_SLAVE,
        
.ext_assign        0x00,
        .
rf_freq           RF_FREQ,
        .
transmission_type CHAN_ID_TRANS_TYPE,
        .
device_type       CHAN_ID_DEV_TYPE,
        .
device_number     CHAN_ID_DEV_NUM,
        
//.device_number     = (uint16_t) (NRF_FICR->DEVICEID[0]),
        
.channel_period    CHAN_PERIOD,
        .
network_number    ANT_NETWORK_NUM,
    
};

    
err_code ant_channel_init(&broadcast;_channel_config);
    
APP_ERROR_CHECK(err_code);

    
// Open channel.
    
err_code sd_ant_channel_open(BROADCAST_CHANNEL_NUMBER);
    
APP_ERROR_CHECK(err_code);

    
// Configure Tx power for the channel
    
err_code sd_ant_channel_radio_tx_power_set(BROADCAST_CHANNEL_NUMBERRADIO_TX_POWER_LVL_50);
    
APP_ERROR_CHECK(err_code);

    
// Set channel search timeout to infinite 
    
err_code sd_ant_channel_rx_search_timeout_set(BROADCAST_CHANNEL_NUMBER255);
    
//err_code = sd_ant_channel_search_timeout_set(BROADCAST_CHANNEL_NUMBER, 255);



How to detect a timeout, is there an event for that?

Thanks.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

See ANT Message Protocol and Usage Section 9.5.6.1 "EVENT_RX_SEARCH_TIMEOUT".

It looks like you are configuring an infinite timeout, so you shouldn't be hitting that, but you may be seeing one of the other events that could explain the issue you are running into.

You may be getting channel in wrong state for example if you need to set the timeout before opening.      

Signature

Ian Haigh

Rank

Total Posts: 16

Joined 2020-10-16

PM

Thanks.

I'll try these options and update the thread.      
Rank

Total Posts: 16

Joined 2020-10-16

PM

Looks like the inifinite scan cycle option does not work even if channel is opened after this initialization/config. Will look into second option.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

Can you share which version of the nrf sdk and softdevice you are using? I checked with the stack team and the 255 value for search timeout should be causing an infinite search behavior.

This would be verified by the absence of search timeout events with 255, and presence of search timeout events with a lesser value. Avoid verification by using the "it connected test" as there could be other issues causing that ill behavior.      

Signature

Ian Haigh

Rank

Total Posts: 16

Joined 2020-10-16

PM

SDK ver = 16.0
Softdevice ver = 6.1.1 (ANT_s340_nrf52840_6.1.1.hex)
Device = nRF52840      
Rank

Total Posts: 16

Joined 2020-10-16

PM

Hi,

It's an old ticket but issue remains.

Is there a way to know that slave is unable to establish a connection with the the master. May be with this information, it tries to re-open the channel and connect with the master?

Currently every time I power cycle my master device, I have to power cycle the slave devices as well otherwise the slave are unable to communicate with master.

Note: the channel search time out value is 255.

Thanks.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

As mentioned in prior post: if you get a search timeout (EVENT_RX_SEARCH_TIMEOUT) you can reopen the channel if you do not wish it to close. Search timeout indicates that the slave was unable to establish a connection with a master.      

Signature

Ian Haigh

RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

Note: You should get EVENT_RX_SEARCH_TIMEOUT followed closely by EVENT_CHANNEL_CLOSED. You will want to set state in your code in handling EVENT_RX_SEARCH_TIMEOUT that causes an open to occur when handling EVENT_CHANNEL_CLOSED, or just always reopen in handling EVENT_CHANNEL_CLOSED, depending on what other transitions you have to closed.      

Signature

Ian Haigh