UART problem receives junk data

Hi,

i wrote uart1 program to receive 120 bytes data continuosly.
but randomly it receive only 3 junk bytes for some time.

i confirmed by debugging print the DataSize variable in Datahandler function.
it shows DataSize is 3 .that three bytes are junk data.

why it happens…?
could you please tell me where is the problem .?

regards
nagendra

Where is it receiving them from?
ie, what sends them?

How do you know that it’s not just the sender randomly sending 3 junk bytes?!

No - you haven’t given nearly enough information for that to be remotely possible.

However, in any such situation, there are these possibilities:

  1. The transmitter is transmitting rubbish
  2. The transmitter & receiver configurations do not match
  3. The data is being corrupted in transit (eg, faulty cable)
  4. The receiver has a hardware fult
  5. The receiver has a software bug
  6. Some combination of the above

You need to adopt a systematic, step-by-step process to pinpoint the problem(s)…