This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt vect never called [C++]

I have template class for Uart. For initialization of interrupt I use global function which is defined as extern "C", but my interrupt is never called. I cannot find whats wrong.



/* header file */
extern "C" void USART0_RX_vect (void) __irq;

template <int RXBuf, int TXBuf>
class Uart
{
public:
                void initInterrupt (uint32_t a_baudrate, LPC_UART_TypeDef* a_channel)
                {
                        init (a_baudrate, a_channel);

                        if (a_channel == LPC_UART0) {
                                LPC_VIC->IntEnable |= INT_EN_UART0; //enable UART0 int
                                LPC_VIC->IntSelect = 0x00000000;
                                LPC_VIC->VectCntl8 = IRQ_SLOT_UART0 | IRQ_SLOT_ENABLE;
                                LPC_VIC->VectAddr8 = (unsigned long) USART0_RX_vect;
                                }
                        else if (a_channel == LPC_UART1) {
                                LPC_VIC->IntEnable |= INT_EN_UART1; //enable UART1 int
                                LPC_VIC->IntSelect = 0x00000000;
                                LPC_VIC->VectCntl7 = IRQ_SLOT_UART1 | IRQ_SLOT_ENABLE;
                                LPC_VIC->VectAddr7 = (unsigned long) USART1_RX_vect;
                                }
                        a_channel->IER |= UART_RDA_ENABLE | UART_RX_STAT_ENABLE;
                }

};

/* cpp file */

void USART0_RX_vect (void) __irq
{
    g_Uart->receiverHandler (LPC_UART0);
    LPC_VIC->VectAddr = 0x0;
}

Parents Reply Children