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

  • Hi Kenneth,

    Thanks for the reply,

    I can't get error code that caused the assert,

    Code and output :

    when I commented out : 

     //err_code=sd_ant_channel_open(BSC_CHANNEL_NUM);
                                         //APP_ERROR_CHECK(err_code);

    It's running and scanning for HRM, but will not work if I open BSC and BPW,

    Could you help us ?

    Kind regards,

    Rixtronix

  • In your project, there should be a file called app_error_weak.c (and likely also app_error_handler_keil.c since you are using Keil IDE), app_error_weak.c contain a fault handler: app_error_fault_handler()

    This fault hault handler is called when an api return an error code, if you have added DEBUG to your preprocessor (as I can see you have) then this file should provide information about file name, line number and error code.

    Kenneth

  • Hi Kenneth,

    Thanks for the reply,

    I saw :

    SVCALL(SVC_ANT_CHANNEL_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout));

    at

    nRF5_SDK_17.0.2_d674dde\components\softdevice\SoftDevice\headers\include\ant_interface.h LINE 457

    can I change

    uint8_t ucTimeout; to

    int32_t Timeout

    and Timeout =10000 ?

    Regards,

    Rixtronix

  • Looking at the description in ant_interface.h

    /** @brief This function sets the channel search timeout. For a slave channel, the configuration applies to rx search
     *         timeout. For a master channel, the configuration applies to timeout for starting a transmitter using group transmitter
     *         initiation requirements.
     *
     * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set.
     * @param[in] ucTimeout is an unsigned char (1 octet) denoting the timeout value.
                  When applied to an assigned slave channel, ucTimeout is in 2.5 second increments. Default = 10 (25s) at channel assignment
                  When applied to an assigned master channel, ucTimeout is in 250ms increments. Default = 0 (disabled) at channel assignment
     *
     * @return  ::NRF_SUCCESS
     *          ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED
     */
    #define sd_ant_channel_rx_search_timeout_set(ucChannel, ucTimeout)      sd_ant_channel_search_timeout_set(ucChannel, ucTimeout)
    SVCALL(SVC_ANT_CHANNEL_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout));

    ucTimeout is an unsigned char (1 octet) denoting the timeout value, the increment is mentioned in the description depending on slave or master channel.

    Best regards,
    Kenneth

  • Hi Kenneth,

    Thanks for the reply,

    Is it possible that I reload the timeout with timer,

    For example I set timer every 60s, and call  

    sd_ant_channel_rx_search_timeout_set(ucChannel, ucTimeout)

    So I can get long timeout ?

    Kind regards,

    Rixtronix

Related