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!
Hello!
In regard with the sample code requested, you may refer to the application note below. At chapter 6 you may refer to the firmware description.
Interfacing NXP bridge IC with NXP ARM microcontroller
Regarding the trigger level, can you please read the Receiver FIFO level register (RXLVL) when the interrupt is triggered? Can you share your results?
I hope this information helps!
Regards,
David
Hello David,
Thanks. I’ve already solved the problem.
Best,
Soodeh