Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

UART Problem

UART Problem

2005-03-02 by mobilsiten

I cant get this to work. I only want to turn on a led if I recive
something on UART1. 
This is the code:

void init_serial (void)      // Initialize Serial Interface  
{ 
	unsigned dummy;
	unsigned short baud = 9600, baud_rate;     

	PINSEL0 = 0x00050000;    /* Enable RxD1 and TxD1 */
	
	U1LCR = 0x0D3;            /* 8 bits, no Parity, 1 Stop bit */
	U1IER = 0;               /* Disable UART1 Interrupts */
	
	VICVectAddr0 = (unsigned long)ElsyIRQ;
	VICVectCntl0 = 0x20 | 7; /* UART1 Interrupt */
	VICIntEnable = 1 << 7;   /* Enable UART1 Interrupt */

 	baud_rate	  = UART_BAUD(baud);
	U1DLL 		  = (signed char)(baud_rate);			//LSB
  	U1DLM 		  = (signed char)((baud_rate) >> 8); //MSB 
 	U1LCR 		  = 0x00000003;              // DLAB = 0 

	dummy = U1IIR;   /* Read IrqID - Required to Get Interrupts Started */
	U1IER = 3;       /* Enable UART1 RX and THRE Interrupts */

}

void ElsyIRQ (void) 
{
	IOSET1 = 0x000F0000;           // Turn on LEDs
	VICVectAddr = 0x00000000;
}

Can someone please help me?

Re: UART Problem

2005-03-02 by mobilsiten

--- In lpc2000@yahoogroups.com, "mobilsiten" <petertholander@h...> wrote:
> 
> I cant get this to work. I only want to turn on a led if I recive
> something on UART1. 
> This is the code:
> 
> void init_serial (void)      // Initialize Serial Interface  
> { 
> 	unsigned dummy;
> 	unsigned short baud = 9600, baud_rate;     
> 
> 	PINSEL0 = 0x00050000;    /* Enable RxD1 and TxD1 */
> 	
> 	U1LCR = 0x0D3;            /* 8 bits, no Parity, 1 Stop bit */
> 	U1IER = 0;               /* Disable UART1 Interrupts */
> 	
> 	VICVectAddr0 = (unsigned long)ElsyIRQ;
> 	VICVectCntl0 = 0x20 | 7; /* UART1 Interrupt */
> 	VICIntEnable = 1 << 7;   /* Enable UART1 Interrupt */
> 
>  	baud_rate	  = UART_BAUD(baud);
> 	U1DLL 		  = (signed char)(baud_rate);			//LSB
>   	U1DLM 		  = (signed char)((baud_rate) >> 8); //MSB 
>  	U1LCR 		  = 0x00000003;              // DLAB = 0 
> 
> 	dummy = U1IIR;   /* Read IrqID - Required to Get Interrupts Started */
> 	U1IER = 3;       /* Enable UART1 RX and THRE Interrupts */
> 
> }
> 
> void ElsyIRQ (void) 
> {
> 	IOSET1 = 0x000F0000;           // Turn on LEDs
> 	VICVectAddr = 0x00000000;
> }
> 
> Can someone please help me?

Hmm, very strange! Now it works without any changes....

Thanks anyway!

Re: [lpc2000] UART Problem

2005-03-02 by Bill Knight

A quick observation; the IO pin direction will most likely need to be set
as an output and it's function may possibly need to be set to GPIO.

Regards
-Bill Knight
R O SoftWare &
http://www.theARMPatch.com




On Wed, 02 Mar 2005 09:19:55 -0000, mobilsiten wrote:



I cant get this to work. I only want to turn on a led if I recive
something on UART1. 
This is the code:

void init_serial (void)      // Initialize Serial Interface  
{ 
	unsigned dummy;
	unsigned short baud = 9600, baud_rate;     

	PINSEL0 = 0x00050000;    /* Enable RxD1 and TxD1 */

	U1LCR = 0x0D3;            /* 8 bits, no Parity, 1 Stop bit */
	U1IER = 0;               /* Disable UART1 Interrupts */

	VICVectAddr0 = (unsigned long)ElsyIRQ;
	VICVectCntl0 = 0x20 | 7; /* UART1 Interrupt */
	VICIntEnable = 1 << 7;   /* Enable UART1 Interrupt */

 	baud_rate	  = UART_BAUD(baud);
	U1DLL 		  = (signed char)(baud_rate);			//LSB
  	U1DLM 		  = (signed char)((baud_rate) >> 8); //MSB 
 	U1LCR 		  = 0x00000003;              // DLAB = 0 

	dummy = U1IIR;   /* Read IrqID - Required to Get Interrupts Started */
	U1IER = 3;       /* Enable UART1 RX and THRE Interrupts */



void ElsyIRQ (void) 

	IOSET1 = 0x000F0000;           // Turn on LEDs
	VICVectAddr = 0x00000000;


Can someone please help me?






Yahoo! Groups Links

Re: UART Problem

2005-03-02 by mobilsiten

Yes, sorry I did that in the main function...

--- In lpc2000@yahoogroups.com, "Bill Knight" <BillK@t...> wrote:
> A quick observation; the IO pin direction will most likely need to
be set
Show quoted textHide quoted text
> as an output and it's function may possibly need to be set to GPIO.
> 
> Regards
> -Bill Knight
> R O SoftWare &
> http://www.theARMPatch.com
> 
> 
> 
> 
> On Wed, 02 Mar 2005 09:19:55 -0000, mobilsiten wrote:
> 
> 
> 
> I cant get this to work. I only want to turn on a led if I recive
> something on UART1. 
> This is the code:
> 
> void init_serial (void)      // Initialize Serial Interface  
> { 
> 	unsigned dummy;
> 	unsigned short baud = 9600, baud_rate;     
> 
> 	PINSEL0 = 0x00050000;    /* Enable RxD1 and TxD1 */
> 
> 	U1LCR = 0x0D3;            /* 8 bits, no Parity, 1 Stop bit */
> 	U1IER = 0;               /* Disable UART1 Interrupts */
> 
> 	VICVectAddr0 = (unsigned long)ElsyIRQ;
> 	VICVectCntl0 = 0x20 | 7; /* UART1 Interrupt */
> 	VICIntEnable = 1 << 7;   /* Enable UART1 Interrupt */
> 
>  	baud_rate	  = UART_BAUD(baud);
> 	U1DLL 		  = (signed char)(baud_rate);			//LSB
>   	U1DLM 		  = (signed char)((baud_rate) >> 8); //MSB 
>  	U1LCR 		  = 0x00000003;              // DLAB = 0 
> 
> 	dummy = U1IIR;   /* Read IrqID - Required to Get Interrupts Started */
> 	U1IER = 3;       /* Enable UART1 RX and THRE Interrupts */
> 
> 
> 
> void ElsyIRQ (void) 
> 
> 	IOSET1 = 0x000F0000;           // Turn on LEDs
> 	VICVectAddr = 0x00000000;
> 
> 
> Can someone please help me?
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.