AnsweredAssumed Answered

SC16IS762 FIFO operation

Question asked by Dan Smithers on Sep 14, 2018
Latest reply on Sep 18, 2018 by Dan Smithers

I am trying to set up the SC16IS762 dual UART in a polled mode and I am expecting to be able to read several bytes from the receiver FIFO.

There is no flow control set up and RTSA, RTSB, CTSA and CTSB are not connected.

I am able to send several bytes using the Tx FIFO, but cannot get the Rx FIFO to accept more than one character.

I am using SPI to communicate with the device.


First, I initialise the device

    #define E_SC16IS762_CHAN_SEL_A 0
    #define E_SC16IS762_CHAN_SEL_B 1

        // Clear contents of transmit and receive FIFOs, resets FIFO level logic and enables transmit and receive FIFOs

         SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_A, FCR, 0x07);

         SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_B, FCR, 0x07);


         // Disable interrupts on FIFO levels as we want to poll

        SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_A, IER, 0x00);          SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_B, IER, 0x00);


         // Set GPIO lines to output

         SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_A, IODir, 0xFF); // all o/p

         SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_A, IOState, 0x00); // all 0

         // disable interrupts on GPIO state change

         SC16IS762_SPI_WriteByte (E_SC16IS762_CHAN_SEL_A, IOIntEna, 0x00);


and then the two UART channels.

    ChannelInit(channel, baud)
        // enable FIFO mode and set Rx trigger to 56

        SC16IS762_SPI_WriteByte (channel, FCR, 0x81);

        // Set Extra Features all off

        SC16IS762_SPI_WriteByte (channel, EFCR, 0x00);

        // 0x80 to program baud rate

        SC16IS762_SPI_WriteByte (channel, LCR, 0x80);

        // divisor LSB

        SC16IS762_SPI_WriteByte (channel, DLL, (baudRate[rate] & 0xFF));

        // divisor MSB

       SC16IS762_SPI_WriteByte (channel, DLH, (baudRate[rate] >> 8);


        // access EFR register

        SC16IS762_SPI_WriteByte (spiModule, pDev->channel, LCR, 0xBF);

        // disable enhanced registers

        SC16IS762_SPI_WriteByte (spiModule, pDev->channel, EFR, 0X00);
        // 8 data bit, 1 stop bit, no parity

        SC16IS762_SPI_WriteByte (spiModule, pDev->channel, LCR, 0x03, 1);


I have the dual UART on our own card with a crystal attached to pin XTAL1, XTAL2 is not connected.

I have connected TXA to RXB and vice versa.

I have a test application that sets both channels up with the same baud rate and then sends four bytes of data to one channel and reads it back on the other

    uint8_t rxBuff[16];
    uint32_t test1 = 0xAA55AA55;
    uint32_t test5 = 0x0F0AF50D;
    BSP_RS422_SendData(ch1, (uint8_t *)&test1, 4);
    BSP_RS422_ReadData(ch2, rxBuff, 16);
    ARM_printf("Received 0x%x\n", *(uint32_t *)rxBuff);

    BSP_RS422_SendData(ch2, (uint8_t *)&test5, 4);
    BSP_RS422_ReadData(ch1, rxBuff, 16);
    ARM_printf("Received 0x %x\n", *(uint32_t *)rxBuff);

I have an oscilloscope set up on the output and see the full four bytes transmitted.

When I inspect the RXLVL register, it contains the value 1 and the RHR contains the first byte transmitted.


Please can someone suggest what I have missed in the setup.


Many thanks