Hi
Is anyone able to help me. I am new to the LPC1857.
I am using the MCB1857 development board and i want to use USART3.
I can send characters after configuration using the below:-
LPC_USART3->THR = 'K';
I am unable to get the interrupt to trigger at all. My code is:-
/*protoctype*/
__irq void UART3_IRQHandler (void);
/*****************************************************************************/
/**************** SET UP USART 3 *************************************/
LPC_SCU->SFSP2_3 = 0x02;
LPC_SCU->SFSP2_4 = 0x02;
LPC_USART3->LCR = 0x83; /*line control register.. stop, data bits etc.... 8 data bits, 1stop bit, NO parity*/
LPC_USART3->FDR = 0; /*fractional divide*/
LPC_USART3->DLL = 78; /*divide latch LSB... 9600 buad*/
LPC_USART3->DLM = 0; /*divide latch MSB*/
LPC_USART3->LCR = 0x03; /* disab;e DLAB*/
LPC_USART3->FCR = 0x07; /*Fifo buffer*/
LPC_USART3->IER = 0x01; /*enable interupt*/
NVIC_SetPriority(USART3_IRQn, 1);
NVIC_EnableIRQ(USART3_IRQn); /*enable USART3 interupt*/
/********************************************************************************/
/* ####### USART interupt function ########################## */
/********************************************************************************/
__irq void UART3_IRQHandler(void)
{
unsigned short ushLocalVar = 0;
/*recieving a byte*/
if(LPC_USART3->LSR & 0x01)
{
ushLocalVar = LPC_USART3->RBR;
}
if((ushLocalVar == 'A') || (ushLocalVar == 'a'))
{
/*transmit a byte*/
if(LPC_USART3->LSR & 0x20)
{
LPC_USART3->THR = 'K';
}
}
else
{
LPC_USART3->IER = 0x01; /*re-enable interupt*/
}
}