EVENT_CHANNEL_CLOSED ?

Dear Members,

How can I scan continously if I loss the sensor,

I have made at this function :

static void ant_evt_handler(ant_evt_t * p_ant_evt, void * p_context)

case EVENT_CHANNEL_CLOSED:
									  NRF_LOG_INFO("EVENT_CHANNEL_CLOSED...\r\n");
								    NRF_LOG_INFO("BSP_INDICATE_SCANNING...\r\n");//31Mar22 Rixtronix LAB
                    
								     err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
					
								    nrf_pwr_mgmt_feed(); //Function for indicating activity.
								    
								
                    break;

but it's not scanning when it loss the sensor ,

Any clues ?

Kind regards,

Rixtronix

Parents
  • Hi

    Unfortunately our ANT expert is out of office for the Easter vacation. They'll get back to you on Tuesday April 19th. Happy Easter!

    Best regards,

    Simon

  • Hi Simon,

    Thanks for the reply,

    From this ant_evt_handler,

    static void ant_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
    {
        ret_code_t err_code = NRF_SUCCESS;
    
        if (m_channel != p_ant_evt->channel)
        {
            return;
        }
    
        switch (m_channel_type)
        {
            case CHANNEL_TYPE_SLAVE:
                /* fall through */
            case CHANNEL_TYPE_SLAVE_RX_ONLY:
                switch (p_ant_evt->event)
                {
                    case EVENT_RX:
    									  NRF_LOG_INFO("EVENT_RX...\r\n"); 
                        err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
    								    
    								    nrf_pwr_mgmt_feed(); //Function for indicating activity.
                        break;
    
                    case EVENT_RX_FAIL:
    									  NRF_LOG_INFO("EVENT_RX_FAIL...\r\n"); 
    								    NRF_LOG_INFO("RIXTRONIX EVENT_RX_FAIL...\r\n"); 
                        err_code = bsp_indication_set(BSP_INDICATE_RCV_ERROR);
    								
                        break;
    
                    case EVENT_RX_FAIL_GO_TO_SEARCH:
    									  NRF_LOG_INFO("EVENT_RX_FAIL_GO_TO_SEARCH...\r\n");
    								    NRF_LOG_INFO("RIXTRONIX EVENT_RX_FAIL_GO_TO_SEARCH...\r\n"); 
                        err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
                        break;
    
                    case EVENT_CHANNEL_CLOSED:
    									  NRF_LOG_INFO("EVENT_CHANNEL_CLOSED...\r\n");
    								    NRF_LOG_INFO("BSP_INDICATE_SCANNING...\r\n");//31Mar22 Rixtronix LAB
                        //nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF); //default
    								     err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
    									  //nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_CONTINUE);
    								    nrf_pwr_mgmt_feed(); //Function for indicating activity.
    								    
    								
                        break;
    
                    case EVENT_RX_SEARCH_TIMEOUT:
    									 //Rixtronix LAB
    								   //8 Sept 2021, 
    								   //on search timeout, and idle, make device on if there is a signal from sensor ?
    									  NRF_LOG_INFO("EVENT_RX_SEARCH_TIMEOUT...\r\n");
                        //err_code = bsp_indication_set(BSP_INDICATE_IDLE);//default
    								    err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
    								    nrf_pwr_mgmt_feed(); //Function for indicating activity. default
    								     
                        break;
                }
                break;
        }
        APP_ERROR_CHECK(err_code);
    }

    on EVENT_CHANNEL_CLOSED:

    How can I rescan again ?

    Best regards,

    Rixtronix LAB

  • Hi Kenneth,

    Thanks for the reply,

    Is it possible that I scan only and not opening the channel, and the channel is opened by the time there's master / sensor activated.
    Can I scan more than one channel ? 0,1,2, HRM,BSC and BPWR
    The code :

    E:\nRF5_SDK_17.0.2_d674dde\examples\ant\ant_continuous_scanning_controller\main.c

    Line 295 :

    /**@brief initialize application
     */
    static void continuous_scan_init()
    {
        uint32_t 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);
    
        // Configure channel 0 for scanning mode, but do not open it.
        // The scanning channel will be opened in scan mode for a short amount of time on a button press.
        ant_channel_config_t channel_config =
        {
            .channel_number    = ANT_SCAN_CHANNEL_NUMBER,
            .channel_type      = CHANNEL_TYPE_SLAVE,
            .ext_assign        = 0x00,
            .rf_freq           = RF_FREQ,
            .transmission_type = CHAN_ID_TRANS_TYPE,
            .device_type       = CHAN_ID_DEV_TYPE,
            .device_number     = 0x00,          // Wildcard
            .channel_period    = 0x00,          // Not used, since this is going to be scanning
            .network_number    = ANT_NETWORK_NUM,
        };
    
        err_code = ant_channel_init(&channel_config);
        APP_ERROR_CHECK(err_code);
    
        // Assign a second channel for sending messages on the reverse direction
        // There is no need to configure any other parameters, this channel is never opened;
        // its resources are used by ANT to send messages in the reverse direction while in
        // continuous scanning mode.
        err_code = sd_ant_channel_assign(ANT_RESPONSE_CHANNEL_NUMBER,
                                         CHANNEL_TYPE_SLAVE,
                                         ANT_NETWORK_NUM,
                                         0x00);
        APP_ERROR_CHECK(err_code);
    }
    

    I can not compile this :
    ..\..\..\..\..\..\components\libraries\util\sdk_errors.h(73): error:  #5: cannot open source input file "nrf_error.h": No such file or directory,

    I got 44 errors similar like above,
    It's already in directory, how can I fix it ?

    Thank you and kind regards,

    Rixtronix LAB

  • Hi Kenneth,

    Thanks for the reply and the examples,

    I read :

    Do you have a similar function like "ANT_OpenRxScanMode" in nRF SDK ?

    Kind regards,

    Rixtronix LAB

  • Hi Kenneth,

    Is there anyway to modify this xml file for fixing the directory issue ?

    Kind regards,

    Rixtronix LAB

  • Hi Kenneth,

    We fixed the path issue,

    Solution :

    Thanks,

    Kind regards,

    Rixtronix LAB

  • Hi Kenneth,

    Thanks for your reply,

    Is it possible with this line ?

    err_code = sd_ant_channel_search_timeout_set(HRM_CHANNEL_NUM, 1888);
                                            APP_ERROR_CHECK(err_code);

    or we need a timer similar alike @

    nRF5_SDK_17.0.2_d674dde\examples\ant\ant_continuous_scanning_controller\main.c

    Line 283

    err_code = app_timer_create(&m_scan_timer_id,
                                    APP_TIMER_MODE_SINGLE_SHOT,
                                    scan_timeout_event);

    Kind regards,

    Rixtronix LAB

Reply
  • Hi Kenneth,

    Thanks for your reply,

    Is it possible with this line ?

    err_code = sd_ant_channel_search_timeout_set(HRM_CHANNEL_NUM, 1888);
                                            APP_ERROR_CHECK(err_code);

    or we need a timer similar alike @

    nRF5_SDK_17.0.2_d674dde\examples\ant\ant_continuous_scanning_controller\main.c

    Line 283

    err_code = app_timer_create(&m_scan_timer_id,
                                    APP_TIMER_MODE_SINGLE_SHOT,
                                    scan_timeout_event);

    Kind regards,

    Rixtronix LAB

Children
No Data
Related