uart interrupt always on

Hi all,

I use a thread to read on the uart when they have interrupt on serial 1 RX. I use a connectcore 9C with NET +OS 7.4.2 The problem is that the interrupt is always on and the serial cable is not plug… You can see my code. Any one have idea?

void * stackUART;
stackUART = malloc (8192);
if (stackUART == NULL) {
printf (“Unable to allocate UART Control thread stack.”);
return -1;
}

result = tx_thread_create (&_uartThread, “UART Thread”, decodeUART, 0, stackUART, 8192, 10, 10, 1, TX_DONT_START);
if (result != TX_SUCCESS) {
printf (“Unable to allocate UART thread stack.”);
return -1;
}

// Open serial port A for Modbus communication.
_modbusPort = open (“/com/0”, O_RDWR | O_NONBLOCK);
if (_modbusPort <=0) {
printf (“Unable to open modbusPort”);
return -1;
}

    // get the current serial attributes
    if (tcgetattr(_modbusPort, &amp;SerialModbusPortSettings) &lt; 0)
    {
        printf("tcgetattr modbus failed

");
return -1;
}

    // set the baudrate modbus
    cfsetospeed(&amp;SerialModbusPortSettings, MODBUS_BAUDRATE);
    if (tcsetattr(_modbusPort, TCSANOW, &amp;SerialModbusPortSettings) &lt; 0)
    {
        printf("tcsetattr modbus failed

");
return -1;
}

naIsrInstall(SER1RX_INTERRUPT,(NA_ISR_HANDLER)uartISR, NULL);

void uartISR(void * param)
{
_uartReceved = true;
tx_thread_resume(&_uartThread);

return;

}

void decodeUART(ULONG inValue)
{
int result;
char buff[10];
while(1)
{
if(_uartReceved)
{
result = naInterruptDisable(SER1RX_INTERRUPT);
read(_modbusPort,buff,sizeof buff);

	    _uartReceved = false;
	    result = naInterruptEnable(SER1RX_INTERRUPT);
	}
	tx_thread_suspend(tx_thread_identify());
}

}

thanks for the reply.

I think you need to use :-
BBUS_DMA01_INTERRUPT instead of SER1RX_INTERRUPT…

See attached.

ok but when i change it for this:
result = naIsrInstall(BBUS_DMA01_INTERRUPT,(NA_ISR_HANDLER)uartISR, NULL);
if(result!=SUCCESS)
{
if(result==NA_INTERRUPT_IN_USE)
printf(“The interrupt level is already in use”);
if(result==NA_INVALID_LEVEL)
printf(“The value of id is invalid”);
}

i got interrupt level is already in use error…