I'va already posted this problem in section(Going crazy with UART (witch hunt)), but maybe this a better section to post.
I'm using a custom board with MK66F2M0 device, MCUXpresso 10.1.1, SDK 2.3.0 and UART FreeRTOS driver: the UART is connected to a GSM modem.
I've made a test with an oscilloscope, recording all the signals. The three images show what I found. The packet is the byte 0x01 repeated 144 times received from a GSM modem connected to the UART. The waves are the RX signal, the TX signal, the CTS signal and the RTS signal respectively. The UART is configured with RX FIFO enabled with a watermark of 1.
This image shows the packet start: at the end of the stop bit of the first byte, the RTS signal goes high because the RXFIFO watermark is configured to 1 byte: the interrupt routine handle the RDRF flag, it reads the D register so the RTS signal goes low. At the end of every byte there is the same behaviour: after the stop bit there is the start bit of the subsequent character
This image shows the error: the first RTS rise is at the end of the stop bit, then there is the start bit of another character. The strange thing is that the second RST rise is not at the end of the stop bit, but at the end of the first data bit of the subsequent character. From this point forward, all the charcters are received as 0x40, as if the first bit of data were actually the start bit.
This image shows the packet end: the last character is received as 0xC0.
I don't know how it can be generated: all the previous characters are received correctly and the waveforms are ever the same; I don't know why suddenly the RTS signal goes hig in the wrong place.
What esle can I verify?