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

UART0_IRQHandler here EVENTS_RXDRDY event is not generated after receiving 1st 6 bytes

Here i have made an UART0_IRQHandler routine. When i try to send some 50 bytes data through UART using PC tool here its receiving bytes, but it only receives 1st 6 bytes which i send. After that nothing is happening. I am not getting any interrupt after that.

Here i even referred nRF51_Series_Reference_Manuel there they have written that, The UART receiver chain implements a FIFO capable of storing six incoming RXD bytes before data is overwritten. Bytes are extracted from this FIFO by reading the RXD register. When a byte is extracted from the FIFO a new byte pending in the FIFO will be moved to the RXD register. The UART will generate an RXDRDY event every time a new byte is moved to the RXD register.
Here in my case bytes form FIFO are not getting written to RXD register after 1st cycle ??

Can anybody help me out with this??? Here below is the Interrupt routine which i made.

void UART0_IRQHandler(void) {

// Handle reception
if (NRF_UART0->EVENTS_RXDRDY != 0)
{
    // Clear UART RX event flag
    NRF_UART0->EVENTS_RXDRDY = 0;
    
			if(st_rcvmsg_ok==false)                           // Protect Against RxBuffer OverWrite 
			{
					st_rcvtimeout = TIME_BTWN_TWO_CHAR;      			// Time out between two char
					rx_buf[st_rcvcntr] = (uint8_t)NRF_UART0->RXD;	// Write received byte 
				
					st_rcvcntr++;
					
					if(st_rcvcntr==2)
					{
							rx_msg_len=(rx_buf[1]+(rx_buf[0]*256)); 
					}
				
					if(st_rcvcntr>=3)
					{
							if(st_rcvcntr == (rx_msg_len + 2))
							{
									if(initialization_complete_flg)				//flag set after uart initilization.
									{
										st_rcvmsg_ok = true;	    					// Just set flag and call routine from while(1)
										st_rcvcntr=0;
										st_rcvtimeout = 0;
									}
									
									
							}
					}
			}		
}	
			
// Handle errors.
if (NRF_UART0->EVENTS_ERROR != 0)
{
    // Clear UART ERROR event flag.
    NRF_UART0->EVENTS_ERROR = 0;
	}

}

Parents
  • Hi jayesh

    Yes, as the nRF51 Series Reference Manual indicates, a new byte should be moved to the RXD register when you extract a byte from it if there are any remaining bytes in the 6 byte FIFO. This should generate a RXDRDY event. I can think of several ways for the RXDRDY event not to be generated:

    • The RXDRDY event is not cleared after entering the UART interrupt handler. Your code shows that you are clearing the event.
    • A byte is not extracted from RXD after receiving the RXDRDY event. Seems like you are doing that in your code.
    • The FIFO buffer is empty and therefore a TXDRDY event is not generated when byte is extracted from the RXD register. This might occur if you do not have e.g. flow control enabled (HWFC). Then the PC could write the 50 bytes before the nRF51 UART starts handling incoming UART bytes. When nRF51 UART starts handling bytes, it only has 6 bytes in the FIFO buffer
  • Here my (HWFC) is disabled, but the same thing with HWFC disabled is working with other device code. Here when i debug in code, i found that during 1st interrupt i.e. (1st time) Handle error is happening and after that its not occurring for next 5 bytes. Can you tell me whats the default value of NRF_UART0->EVENTS_ERROR flag or it always goes there 1st time.

    Now even instead of 6 bytes i am started getting 1st 7 bytes dont know how, so i can say its not FIFO related issue ???

Reply
  • Here my (HWFC) is disabled, but the same thing with HWFC disabled is working with other device code. Here when i debug in code, i found that during 1st interrupt i.e. (1st time) Handle error is happening and after that its not occurring for next 5 bytes. Can you tell me whats the default value of NRF_UART0->EVENTS_ERROR flag or it always goes there 1st time.

    Now even instead of 6 bytes i am started getting 1st 7 bytes dont know how, so i can say its not FIFO related issue ???

Children
No Data
Related