Hi,
I am using an NRF52832 on a custom board and I programmed the Broadcast RX code into the board. I use ANTware as the master with a channel period of 4 and send broadcast data which has to be received by the custom board. I use RTT_WriteString to output a string every time a Broadcast is received.
But instead of receiving 4 data packets per second I only receive 1 packet every 2 seconds or so. What could be the reason?
I use SDK 13.1.0. I have also tried this on PCA10040 board with the same results. The code I use is as follows.
void ant_evt_dispatch(ant_evt_t * p_ant_evt)
{
uint32_t err_code;
ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_evt->msg.evt_buffer;
switch (p_ant_evt->event)
{
case EVENT_RX:
if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID)
SEGGER_RTT_WriteString(0,"BC\n");
if (p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID)
SEGGER_RTT_WriteString(0,"ACK\n");
break;
default:
break;
}
}
/**@brief Function for ANT stack initialization.
*
* @details Initializes the SoftDevice and the ANT event interrupt.
*/
static void softdevice_setup(void)
{
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
err_code = softdevice_ant_evt_handler_set(ant_evt_dispatch);
APP_ERROR_CHECK(err_code);
err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
APP_ERROR_CHECK(err_code);
err_code = ant_stack_static_config();
APP_ERROR_CHECK(err_code);
}
/**@brief Function for setting up the ANT module to be ready for RX broadcast.
*/
static void ant_channel_rx_broadcast_setup(void)
{
uint32_t err_code;
err_code = sd_ant_channel_assign(ANT_BROADCAST_CHANNEL_NUMBER,CHANNEL_TYPE_SLAVE,Netno,0x00);
APP_ERROR_CHECK(err_code);
err_code = sd_ant_channel_id_set(ANT_BROADCAST_CHANNEL_NUMBER,0x0000,0x85,0x01); //CHAN_ID_DEV_NUM, CHAN_ID_DEV_TYPE, CHAN_ID_TRANS_TYPE);
APP_ERROR_CHECK(err_code);
err_code = sd_ant_channel_radio_freq_set(ANT_BROADCAST_CHANNEL_NUMBER,FREQ);
APP_ERROR_CHECK(err_code);
err_code = sd_ant_channel_period_set(ANT_BROADCAST_CHANNEL_NUMBER, 4);
APP_ERROR_CHECK(err_code);
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
err_code = sd_ant_channel_search_timeout_set(ANT_BROADCAST_CHANNEL_NUMBER, 0x0F);
APP_ERROR_CHECK(err_code);
err_code = sd_ant_channel_radio_tx_power_set(ANT_BROADCAST_CHANNEL_NUMBER, RADIO_TX_POWER_LVL_3, 0);
APP_ERROR_CHECK(err_code);
// Open channel.
err_code = sd_ant_channel_open(ANT_BROADCAST_CHANNEL_NUMBER);
APP_ERROR_CHECK(err_code);
}
/**@brief Function for application main entry. Does not return.
*/
int main(void)
{
softdevice_setup();
ant_channel_rx_broadcast_setup();
SEGGER_RTT_WriteString(0,"Init");
// Main loop.
for (;;)
{
// Put CPU in sleep if possible.
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}
}
How can I investigate further? Any insights would be appreciated. Thanks.