Not able to get interrupt enable work in LPC4078

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by sinhapra on Mon Aug 25 07:13:08 MST 2014
Working on serial interface in LPC4078.

I am facing a problem in enabling UART1 or UART2 interrupts. Thinking that this is a common problem, may be someone has solution.

LPC4078 Project is using RTX as an OS, RL-CAN driver and serial port to communicate.

RL-CAN driver is able to use NVIC_EnableIRQ(CAN) because that is getting initialize under "Privilage " mode of OS and when I call CAN init first or if I move NVIC_EnableIRQ(UART2) where CAN is initializing its interrupt it works fine.

But if i try to enable UART2 interrupt elsewhere it doesn't work and it generates "HardFault"exception. I also want to use USB lib but I am not able to use it because it doesn't work either.
below serial init function()

uint32 DLreload;
    uint32 ss1;

TxBuffer.in =0;
TxBuffer.out =0;

RxBuffer.in =0;
RxBuffer.out =0;

DLreload = ((SERIAL_PCLK / 16UL) + (baudrate-1)) / baudrate;

    setbit(LPC_SC->PCONP,4);/*power UART2 */
/* Enable TxD1 */
/* Enable RxD1 */
    /* Enable DTR1 */


LPC_UART1->FDR    = 0;                          /* Fractional divider not used       */
LPC_UART1->LCR    = 0x83;                       /* 8 bits, no Parity, 1 Stop bit     */
LPC_UART1->IER = 0;               /* Disable UART1 Interrupts */   
LPC_UART1->DLL = DLreload;
LPC_UART1->DLM = (DLreload >> 8);

LPC_UART1->LCR   = 0x03;                       /* DLAB = 0                          */
CLR_DTR();      /*DTR is active low*/
LPC_UART1->IER = 3;       /* Enable UART1 RX and THRE Interrupts */

// Create CanTask
m_SerialTaskTID = os_tsk_create(SerialTask, OS_TASK_PRI_SERIAL);

Please guide and let me know if i am doing something wrong here..