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

Does radio on NRF51822 uses RTC timers when it is ON?

Hi,

I use NRF51822 as a transmitter in "gazelle mode" so no soft-device is enabled. At the other end I use NRF24LE01 as a receiver. In order to see what is going on in my transmitter code I use two ways of displaying messages. One uses custom UARTprintf function that sends output to terminal connected to the transmitter. Second way, in order not to use UART on the transmitter, uses custom NRFprintf function that packages messages from transmitter and sends them to the receiver. Then receiver uses its UART to send them to the terminal. So the first method does not use radio and the second does.

I put transmitter into sleep using code below. It works up without problem using either RTC0 or RTC1 compare events - only when radio is not used. The TIMER0 is used to time sleep time only. RTC0 or RTC1 compare event is set to send interrupt after 10 second lapsed.

idx=0;
			do {
\#ifdef UART					     
					     UARTprintf("SYSTEM ON! IDX=%d Time=%f ms\n\r",idx,t20);
\#endif
\#ifdef NRFMSGS
					     NRFprintf("SYSTEM ON! IDX=%d Time=%f ms\n\r",idx,t20);
\#endif
					     sensorsReadout();
\#ifdef UART							 
					     UARTprintf("SYSTEM GOING TO SLEEP!\n\r");
\#endif
\#ifdef NRFMSGS
					     NRFprintf("SYSTEM GOING TO SLEEP!\n\r");		
\#endif						
						 p2_timer = timer_StartTiming(TIMER0);
						 __WFI();
						 t20=(double) timer_GetTime(p2_timer)/1000; //ms
						 idx++;
				 } while(idx < 10);

When I enable radio and set NRFMSGS to 1 compare events do not get triggered i.e. interrupt from RTC0 or RTC1 is not triggered and loop from 1 to 10 finishes without delay.

However, when I put nrf_delay_ms(1000) just before p2_timer = timer_StartTiming... line everything works as expected. So it looks that NRFprintf that uses radio prevents proper interrupt catching triggeredby event compare in my rtc handling code.

So what is happening? Where can I find what resourced are tied up by radio? Is RTC0 or RCT1 used by the radio? Is this a problem with Interrupts priority? Priority of RTC0 and 1 interrupt is set to 0 so it is highest possible. Finally is there a function I can use that will tell me that radio has finished like radio_done() :-)

Any light shown into this will be very appreciated a lot.

Cheers

Adam

Related