3 Replies Latest reply on Aug 21, 2018 10:10 AM by GaneshD_41

    UART Data loss



      I'm using an UART (SCB) to communicate with a slave peripheral.

      UART is configured at 115200 BPS, 8 bytes data, parity none, 1 stop bit, oversampling set to 16 (default 12 was not allowed since the data rate error was > 2%)

      Time by time, I experienced data loss or data mangling in direction from slave peripheral to PSOC4. Some data is lost (usually 1 or 2 bytes) and some data received is wrong.

      Usually the missing/wrong data is located in first 3 bytes of the received packet.

      After many many tests and researches, I've studied the UART component datasheet line by line, setting by setting and I've then changed the oversamplig option lowering it from 16 to minimum value of 8.

      Well, this actually completely solved the issue, now there aren't any data reception errors anymore.


      The device is based on the "UART to BLE bridge" demo project and uses the Low Power management code to enter Sleep and Deep Sleep mode when appropriate. By now, I completely avoid entering ANY sleep mode while waiting for a response from UART, but this was not enough to avoid data loss.


      Can you please explain me how the oversampling value is related to that data loss?

        • 1. Re: UART Data loss



          The oversampling should be set according to the SCB clock period as well as the data rate. The relation between the SCB clock period and the baud rate is given by the formula (Tdata = TClock * oversampling factor). If you are using internal clock PSoC automatically derives the clock accordingly. Please share the screenshots showing the error when you are configured oversampling as 16. Also if possible please probe the UART lines and attach the screenshots.




          • 2. Re: UART Data loss

            I can't easily attach a probe to the UART by now, there is no test points for UART lines in our PCB


            some of the incorrect received values (typical error is: first 2 bytes has wrong value and 1 byte missing)




            the expected correct value (after a re transmit request)



            uart configured with oversampling=16 (error occurs):



            uart configured with oversampling=8 (no errors):



            UART advanced configuration (same for both oversamplig set to 8 and 16):


            • 3. Re: UART Data loss



              I would like to reproduce the issue at our side. Please attach the project in this thread.