UART Data loss

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

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?

0 Likes
3 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

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.

Thanks

Ganesh

0 Likes
Anonymous
Not applicable

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)

a8100000003d00810000c30101c3

08000000003d00810000c30101c3

the expected correct value (after a re transmit request)

8005000000003d00810000c30101c3

uart configured with oversampling=16 (error occurs):

1.png

uart configured with oversampling=8 (no errors):

3.png

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

2.png

0 Likes

Hi,

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

Thanks

Ganesh

0 Likes