Hi there, I am trying to implement scanning feature based on timeslots (with BLE). I can receive and transmit my packets in timeslot. However I need to send PACKET_A and then wait for nodes response. My PACKET_A is transmitting correctly, so in (case: NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO) I set the radio to receive data from nodes. Unfortuanetely this part of the code gets stuck timeslot execution. Even NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0 is not calling, but the BLE works fine (MCU running). Is there a limitation that does not allow to transmit and receive in the same timeslot execution?
switch(signal_type)
{
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START:
//Start of the timeslot - set up timer interrupt
signal_callback_return_param.params.request.p_next = NULL;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
NRF_TIMER0->INTENSET = TIMER_INTENSET_COMPARE0_Msk;
NRF_TIMER0->CC[0] = m_slot_length - 1000;
NVIC_EnableIRQ(TIMER0_IRQn);
timer_init();
radio_init(0xA541A68F);
network_time_operations();
break;
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO:
{
radio_state_t radio_state = RADIO_timeslot_IRQHandler();
switch (radio_state)
{
case RADIO_STATE_RX:
printf("Radio RX \r\n");
signal_callback_return_param.params.request.p_next = NULL;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
break;
case RADIO_STATE_TX:
printf("Radio TX \r\n");
if(g_global_network_state == INITIALIZE_NEW_NETWORK)
{
printf("Start sniffing \r\n");
printf("<%d>\n", NRF_TIMER0->CC[0]);
//network_time_operations();
signal_callback_return_param.params.request.p_next = NULL;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
network_sniffing_state(0);
// radio_disable();
} else{
printf("No sniff \r\n");
configure_next_event_normal();
signal_callback_return_param.params.request.p_next = &m_timeslot_request;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
radio_disable();
}
break;
case RADIO_STATE_DISABLED:
printf("Radio disabled \r\n");
break;
}
}
break;
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0:
//Timer interrupt - do graceful shutdown - schedule next timeslot
configure_next_event_normal();
signal_callback_return_param.params.request.p_next = &m_timeslot_request;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
radio_disable();
printf("Timer interrupt - should deinitialize ts \r\n");
printf("<%d>\n", NRF_TIMER0->CC[0]);
break;
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_SUCCEEDED:
//No implementation needed
printf("Extended timeslot \r\n");
break;
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED:
//Try scheduling a new timeslot
printf("Session extension failed, \r\n");
configure_next_event_earliest();
signal_callback_return_param.params.request.p_next = &m_timeslot_request;
signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
break;
default:
//No implementation needed
break;
}
return (&signal_callback_return_param);