AnsweredAssumed Answered

SC16IS752 lock up in ISR

Question asked by Soodeh Haghgoo on Jun 5, 2017
Latest reply on Jun 23, 2017 by Soodeh Haghgoo

Hello,

 

I'm using SC16IS752 to create RS485 port on my system. It's working fine for a short time but after a while I have a crash and got an exception in ISR. I enabled RHR interrupt. I aslo noticed the trigger level is not setting correctly and always is 16 bytes regardless of what I set in TVL register!

Do you have any sample code how to implement the ISR? Mine is like this:

 

char IIR_value_ChA, LSR_value_ChA, readByte;


IIR_value_ChA = Read752(IIR, RS485_DATA_CHAN);
char valA = IIR_value_ChA & 0x0F;

LSR_value_ChA = Read752(LSR, RS485_DATA_CHAN);

 

switch (valA)
{
case SC16IS752_IIR_RLS: // receiver line status (LSR)
case SC16IS752_IIR_RTI: // receiver time-out interrupt
case SC16IS752_IIR_RHR: // receive hold register (RHR) interrupt
{
if (valA == SC16IS752_IIR_RHR)
{
__asm("NOP\n") ;
}

// This will only happen when the chip looses the interrupt sync, do dummy read for re-sync.
if (!(LSR_value_ChA & SPI_UART_DATA_READY))
{
Read752(RHR, RS485_DATA_CHAN);
}

// repeat until receiver FIFO is empty
while (LSR_value_ChA & SPI_UART_DATA_READY) 
{
readByte = Read752(RHR, RS485_DATA_CHAN);
LSR_value_ChA = Read752(LSR, RS485_DATA_CHAN);
}
} break;
default:
break;
}

 

Thank you!

Outcomes