NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

LPC2378 UART0 Rx FIFO Trigger Level problem

No replies
Karthik Venkatesh
Offline
Joined: 2015-11-27
Posts: 15

Hi,

I am trying to understand the UART0 Receive Trigger level feature available in LPC2378.

Problem Description:

I set FCR register for the Trigger level of 4 bytes.

And reading the IIR register for identifying whether Threshold level interrupt has occured.

If yes, then am reading the RXRBR receive buffer 4 times.

When I run this on LPC2378, for the very 1st byte input, interrupt is triggered.

Find the captured output attached herewith.

What am I doing wrong.

Note: I referred an old thread in this forum reg. the same issue, but in vein.

Code is as following:

#define CR_INTEGER_PRINTF
#include "UART.h"
#include "PLL_CONFIG.h"
#include "PRINT.h"

char a[4];

void UART0_INIT(int baud_rate)
{
        unsigned int k;

        k = SET(baud_rate);

        PCONP |= 1<<3; //power to UART0
        PCLKSEL0 |= 0x40; //pclk = cclk
        PINSEL0 |=  0x00000050;

        U0IER |= (1<<1) | (1<<0);          //Enabling the TX and RX interrupts


        U0LCR = 0x83;

        U0DLM = (k/256);
        U0DLL = (k%256);

        U0LCR = 0x03;

        U0FCR |= (1<<6) | (1<<0);         //Setting the RX Trigger level to 4

}

void send_data(char a)
{

         while(!((U0LSR)&0x20));
         U0THR = a;
}

void get_data()
{

        while(U0IIR & 0x04) {                             //Checking if 'Trigger level reached' interrupt flag is set
              a[0]=U0RBR;                                    //Reading 1st RX Byte from U0RBR
              a[1]=U0RBR;                                    //Reading 2nd RX Byte from U0RBR
              a[2]=U0RBR;                                    //Reading 3rd RX Byte from U0RBR
              a[3]=U0RBR;                                    //Reading 4th RX Byte from U0RBR
              for(char i=0;i<4;i++) {
			printf("\n\rChars u entered are %c",a[i]);
              }
        }

}

int main(void)
{

	PLL_Config(6,1,12);
	UART0_INIT(9600);
	

	while(1)
	{
		
		get_data();

		delay(300);
		
	}
}

void delay(int delay)
{
int g,k;
for(g=0;g

Output
0
Your rating: None
feedback