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

Parents
  • Hi Gor,

    For these things it is a good idea to debug using printf statements, as the SoftDevice may cause hanging when you step or stop the debugger.

    Note that if you want to recieve a packet you will want to do this as well after getting NRF_RADIO->EVENTS_READY:

        NRF_RADIO->EVENTS_READY = 0U;
        // Enable radio and wait for ready
        NRF_RADIO->TASKS_RXEN = 1U;
    
        while (NRF_RADIO->EVENTS_READY == 0U)
        {
            // wait
        }
        NRF_RADIO->EVENTS_END = 0U;
        // Start listening and wait for address received event
        NRF_RADIO->TASKS_START = 1U;
    
        // Wait for end of packet or buttons state changed
        while (NRF_RADIO->EVENTS_END == 0U)
        {
            // wait
        }
    
        if (NRF_RADIO->CRCSTATUS == 1U)
        {
            result = packet;
        }
        NRF_RADIO->EVENTS_DISABLED = 0U;
        // Disable radio
        NRF_RADIO->TASKS_DISABLE = 1U;
    
        while (NRF_RADIO->EVENTS_DISABLED == 0U)
        {
            // wait
        }
    

    Best regards,

    Øyvind

  • Hi,

    It might be that you have requested a timeslot that is too short, so that your application will not have time to finish. Could you post the configuration of the radio and the timeslot setup?

Reply Children
No Data
Related