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

Program stuck at ant_channel_init

Hi Nordic,

I am trying now to create a star network, in which the central node is master of different slave channels. The idea is to configure and open different independent channels. However, the code gets stuck when I try to open the second channel. I put the code here to see if you guys can help, because I tried many different things and apparently I cannot move forward.

These are the parameters:

// Channel 0 configuration --------------------------------------------------------------- 
#define ANT_ACK_CHANNEL_NUMBER_0   			0x00    /**< ANT Channel 0. */
#define EXT_ASSIGN_NONE_0               0x00    /**< ANT Ext Assign. */

// Channel ID configuration. 
#define ANT_ACK_TRANSMISSION_TYPE_0			0x01    /**< Independent channel . */
#define ANT_ACK_DEVICE_TYPE_0      			0xFF    /**< 0xFF for master - slave 0. */
#define ANT_ACK_DEVICE_NUMBER_0    			0x00    /**< 0x10 for master. Devicewise. */

#define ANT_CHANNEL_PERIOD_0            16384    /**< 2 Hz */
#define ANT_FREQUENCY_0                 66      /**< 2425 MHz */

// Miscellaneous defines. 
#define ANT_NETWORK_NUMBER_0            0x00    /**< Default public network number. */

// Channel 1 configuration--------------------------------------------------------------- 
#define ANT_ACK_CHANNEL_NUMBER_1   			0x01    /**< ANT Channel 1. */
#define EXT_ASSIGN_NONE_1               0x00    /**< ANT Ext Assign. */

// Channel ID configuration. 
#define ANT_ACK_TRANSMISSION_TYPE_1			0x01    /**< Independent channel . */
#define ANT_ACK_DEVICE_TYPE_1      			0x8F    /**< 0x8F for master - slave 1. Pairing bit 1. */
#define ANT_ACK_DEVICE_NUMBER_1    			0x01    /**< 0x10 for master. Devicewise. */

#define ANT_CHANNEL_PERIOD_1            16384    /**< 2 Hz */
#define ANT_FREQUENCY_1                 66     /**< 2425 MHz */

// Miscellaneous defines. 
#define ANT_NETWORK_NUMBER_1            0x00    /**< Default public network number. */

And here the function that sets them up:

static void ant_channel_tx_acknowledge_setup(void)
{
    uint32_t err_code;

    ant_channel_config_t acknowledge_channel_0_config =
    {
        .channel_number    = ANT_ACK_CHANNEL_NUMBER_0,
        .channel_type      = CHANNEL_TYPE_MASTER,
        .ext_assign        = EXT_ASSIGN_NONE_0,
        .rf_freq           = ANT_FREQUENCY_0,
        .transmission_type = ANT_ACK_TRANSMISSION_TYPE_0,
        .device_type       = ANT_ACK_DEVICE_TYPE_0,
        .device_number     = ANT_ACK_DEVICE_NUMBER_0,
        .channel_period    = ANT_CHANNEL_PERIOD_0,
        .network_number    = ANT_NETWORK_NUMBER_0,
    };
		
		err_code = ant_channel_init(&acknowledge_channel_0_config);
    APP_ERROR_CHECK(err_code);
		
		err_code = sd_ant_channel_open(ANT_ACK_CHANNEL_NUMBER_0);
    APP_ERROR_CHECK(err_code);
		
		ant_channel_config_t acknowledge_channel_1_config =
    {
        .channel_number    = ANT_ACK_CHANNEL_NUMBER_1,
        .channel_type      = CHANNEL_TYPE_MASTER,
        .ext_assign        = EXT_ASSIGN_NONE_1,
        .rf_freq           = ANT_FREQUENCY_1,
        .transmission_type = ANT_ACK_TRANSMISSION_TYPE_1,
        .device_type       = ANT_ACK_DEVICE_TYPE_1,
        .device_number     = ANT_ACK_DEVICE_NUMBER_1,
        .channel_period    = ANT_CHANNEL_PERIOD_1,
        .network_number    = ANT_NETWORK_NUMBER_1,
    };

    
		err_code = ant_channel_init(&acknowledge_channel_1_config);
    APP_ERROR_CHECK(err_code);
		
    // Fill tx buffer for the first frame.
    ant_message_send();

    // Open channels.
    
		err_code = sd_ant_channel_open(ANT_ACK_CHANNEL_NUMBER_1);
    APP_ERROR_CHECK(err_code);

As I said, I get stuck at the second ant_channel_init.

Thanks for the help!

Regards.

Related