This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to change new device_number when ANT device is working

Hello,

I use nrf51422 to connect the ANT device(Heart rate monitor) and it can work .

My question is , I want to assign a new device_number to 51422 and use this new device_number to search second ANT+ device ,but I found the 51422 will be reset.

I don't want 51422 to reset ,how could I do?

I use below function to assign a new device_number

void change_device_number(uint16_t device_number) {

uint32_t err_code;

err_code = sd_ant_channel_close(ANT_HRMRX_ANT_CHANNEL);
APP_ERROR_CHECK(err_code);

err_code = sd_ant_network_address_set(ANTPLUS_NETWORK_NUMBER, m_ant_network_key);
APP_ERROR_CHECK(err_code);

err_code = sd_ant_channel_assign(ANT_HRMRX_ANT_CHANNEL,
                                 ANT_HRMRX_CHANNEL_TYPE,
                                 ANTPLUS_NETWORK_NUMBER,
                                 ANT_HRMRX_EXT_ASSIGN);

APP_ERROR_CHECK(err_code);

err_code = sd_ant_channel_id_set(ANT_HRMRX_ANT_CHANNEL,
                                 device_number,
                                 ANT_HRMRX_DEVICE_TYPE,
                                 ANT_HRMRX_TRANS_TYPE);


APP_ERROR_CHECK(err_code);

err_code = sd_ant_channel_radio_freq_set(ANT_HRMRX_ANT_CHANNEL, ANTPLUS_RF_FREQ);


APP_ERROR_CHECK(err_code);

err_code = sd_ant_channel_period_set(ANT_HRMRX_ANT_CHANNEL, ANT_HRMRX_MSG_PERIOD);


APP_ERROR_CHECK(err_code);

err_code = sd_ant_channel_open(ANT_HRMRX_ANT_CHANNEL);
APP_ERROR_CHECK(err_code);


}
Parents
  • What error code do you get? In main there are assert callbacks and app_error_handler that will display the error code and on which line it went wrong. Would also encourage you to try and step through the code with the debugger to see on which line it goes wrong.

Reply
  • What error code do you get? In main there are assert callbacks and app_error_handler that will display the error code and on which line it went wrong. Would also encourage you to try and step through the code with the debugger to see on which line it goes wrong.

Children
No Data
Related