Dual UART with I2C-bus/SPI interface SC16IS752

Thread Starter

kryvosheia

Joined Jul 27, 2020
1
Hello!

I have a question concerning SC16IS752/SC16IS762 IC.
It is a UART expander via SPI.
I have a problem with it.

I configured IC so that every time, it has receive data in buffer,
IC generates interrupt. Then, I read Receive Holding Register (RHR) and get data.

Unfortunately, after some time of operation, IC stops generating interrupts...

I read out from the Data Sheet that there is some magic in TCR and TLR registers...
I tried to do workaround by I still have no result...

Does somebody have some experience with it? Perfectly, if with esp32.
What can be the issue and how I can resolve it.

ioexp_set_prescaller(u, IOEXP_PRESCALER_1);
ioexp_uart_set_baudrate(u, config->uart.baudrate);
ioexp_uart_set_word_length(u, config->uart.word_length);
ioexp_uart_set_parity(u, config->uart.parity);
ioexp_uart_set_stop_bits(u, config->uart.stop_bits);

//to get aceess to TLR and TCR
ioexp_register_write(IOEXP_REG_MCR, u, 0x04);
ioexp_register_write(IOEXP_REG_EFR, u, 0x10);

ioexp_register_write(IOEXP_REG_TCR, u, 0x0F);//4-bytes - resume, 60bytes - halt
ioexp_register_write(IOEXP_REG_TLR, u, 0x10);//trigger - 4 bytes

ioexp_register_write(IOEXP_REG_FCR, u, 0x01);//fifo enable
ioexp_register_write(IOEXP_REG_EFR, u, 0x00);// no flow control!!
ioexp_register_write(IOEXP_REG_EFCR, u, 0); // Enable TX and RX
ioexp_register_write(IOEXP_REG_IER, u, 0x01); // RHR Interrupts enabled
 

Papabravo

Joined Feb 24, 2006
21,159
Generally speaking this type of problem is common. Handling the data in an interrupt routine is the easy part. Exiting an interrupt routine with the interrupt system intact is more nuanced and difficult. You have to read and understand the datasheet very carefully with respect to clearing the interrupt flag and making sure the enables are dealt with properly. Lastly you must ensure that data never gets changed in the interrupt routine and the background program without appropriate measures. You also need to ensure that interrupt routines execute in the smallest possible time. It is a mistake to do any kind of processing of the data in an interrupt routine.
 
Top