Hello everybody.
I need to use the serial port directly, using my own code and receive data by interrupt process.
I wrote the next code but it does not work.
I can see the incoming data and the UART status register change but the interrupt does not work.
/*********************************
This is the Interrupt service Routine
**********************************/
int ISR_A5_RX (void *isrParameter)
{
short data;
data=serial->data_reg;
serial->status_a|=0x80000200;
return 0;
}
void init_serial(void)
{
serial= MERCURY_REGS_1;
serial->ctrl_a=0x0B000A00;//0x3B000A00; 8 bit 1stp parity Odd
serial->bit_rate_reg=0xC014017F;//x16 a 2400bps (FCLK=14.745.600)
serial->ctrl_b=0x04000000;
serial->ctrl_a|=0x80000200;//Starts UART
}
/************************************
MAIN
*************************************/
void applicationStart (void)
{
int num,i;
naIsrInstall(SER2RX_INTERRUPT, ISR_A5_RX, NULL);
init_serial();
naInterruptEnable(SER2RX_INTERRUPT);
tx_interrupt_control(TX_INT_ENABLE);
while(1)
{
num=0;
for(i=0;i<200;i++)
num++;
}
tx_thread_suspend(tx_thread_identify());
}
Any suggestions would be appreciated.