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

Multiprotocol and radio RXIDLE state

Hi nrf51 developers,

I'm developing multiprotocol application by combining BLE and a proprietary protocol. I'm using concurrent multiprotocol timeslots API. Started with the ble_app_hrs_with_timeslot example. In that example timer0 generates interrupt, but I modified a little to generate radio interrupt.

My callback function is bellow

nrf_radio_signal_callback_return_param_t * m_radio_callback(uint8_t signal_type)
{   

    switch(signal_type)
    {
        case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START:
            signal_callback_return_param.params.request.p_next = NULL;
            signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
            radio_configure();
	    /* Enable interrupt on events */
	        NRF_RADIO->INTENSET = RADIO_INTENSET_ADDRESS_Msk | RADIO_INTENSET_DISABLED_Msk | RADIO_INTENSET_READY_Msk;
	   /* Enable RADIO interrupts */
	  		NVIC_ClearPendingIRQ(RADIO_IRQn);
			NVIC_EnableIRQ(RADIO_IRQn);
			NRF_RADIO->PACKETPTR = (uint32_t)&packet;
			NRF_RADIO->EVENTS_READY = 0U;		
			/* Enable RX */
            NRF_RADIO->TASKS_RXEN = 1U; 
            while (NRF_RADIO->EVENTS_READY == 0U)
            {
                // **I DON'T UNDERSTAND WHY, IT ALWAYS STAYS HERE**
            }
	       start_timer();
           break;
	    case NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO:
		  //**NEVER COMES HERE**
 		   break;
    }
    return (&signal_callback_return_param);
}

I tried to debug and figured out that it never goes to RXIDLE state and stays in a while loop (NRF_RADIO->EVENTS_READY == 0U), I cannot understand why.

I'd really appreciate, if someone could help me. Thanks in advance for your time,

Best regards, Gor

  • nrf_radio_signal_callback_return_param_t * m_radio_callback(uint8_t signal_type)

    {   
    
    		switch(signal_type)
        {
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START:
    						start_timer();
    						radio_configure(); // general radio configuration from radio_config.c
    						/* Enable interrupt on events */
    						NRF_RADIO->INTENSET = RADIO_INTENSET_ADDRESS_Msk | RADIO_INTENSET_DISABLED_Msk | RADIO_INTENSET_READY_Msk;
    						/* Enable RADIO interrupts */
    						NVIC_ClearPendingIRQ(RADIO_IRQn);
    						NVIC_EnableIRQ(RADIO_IRQn);
    					
    						NRF_RADIO->PACKETPTR = (uint32_t)&packet;
    						
    						read_packet();
    											
    						signal_callback_return_param.params.request.p_next = NULL;
    						signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
    						break;
    				
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0:
    						m_configure_normal_timeslot();
    						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;  //End the current timeslot and request a new one
    						nrf_gpio_pin_toggle(LED_2);
    						NRF_TIMER0->TASKS_STOP = 1;
    						break;
    				
            case NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO:
    						signal_callback_return_param.params.request.p_next = NULL;
    						signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
    						// not Implemented yet, Because never reaches to this brench
    						break;
    		}
    		return (&signal_callback_return_param);
    
    }
    
  • For the rest of the code I'm using exactly ble_app_hrs_with_timeslot.zip this example code. I changed the timeslot time, but seems it's not the reason. Thanks in advance for your help.

  • The problem Is solved. One need to reset all states in the radio peripheral at first. By setting

    NRF_RADIO->POWER = 1

Related