Not able to get interrupt enable work in LPC4078

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to get interrupt enable work in LPC4078

836 Views
lpcware
NXP Employee
NXP Employee
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 */
    LPC_IOCON->P0_15=1;
/* Enable RxD1 */
    LPC_IOCON->P0_16=1;
    /* Enable DTR1 */
    LPC_IOCON->P0_20=1;   

NVIC_EnableIRQ (UART1_IRQn);

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..
Labels (1)
0 Kudos
Reply
1 Reply

695 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Fri Sep 12 16:41:00 MST 2014
Hi,

Below are some general suggestions for you:

1. enable the USRT interrupt after initializing the pins/baudrate/data format - essentially enable the UART interrupt should be the last step in your UART init.
2. check if there is memory/timing usage conflict between your CAN and UART driver.
3. try out the lpcopen package for USB lib application.
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc40xx-packages
There is a project ea_devkit_4088_usbd_lib_examples available for Keil/IAR/LPCXpresso IDE usage.

regards,
0 Kudos
Reply