Common Serial Port Issues

beaglebone blackserialuart

What are some of reasons that PC terminal receives garbage characters from one microcontroller?

I am using BeagleBone and UART works okay, but after few transmitted command characters from PC terminal to microcontroller, PC terminal starts to receive weird characters while I am trying to send those char commands? What can be the problem?

UART won't work properly for some time, but after few minutes it starts again to work and respond to char commands.

Bauds are same on both sides.

UART acts the same on every PC terminal software.

Best Answer

Common issues that came immediately to mind:

  1. Ground connection: you need a shared ground to get a usable communication, this gives very weird issues like the ones you describe
  2. Unstable clock on either side: as UART has no clock sharing mechanism the clock must be fairly well defined and may not drift much. If you are running from an internal RC oscillator this might be a problem. Better use a resonator or oscillator.
  3. Wrong signal levels: Make sure both sides are working with the same signal levels and you are not trying to feed a TTL signal to a RS232 port.
  4. Polarity setting: define inactive high/low on both sides the same (normally you won't get anything useful if this is wrong)
  5. Correct communication parameters otherwise: baudrate, number of bits, parity, number of stopbits, flowcontrol
  6. RX / TX mixed up: Often the signals are called RX and TX for receive and transmit. It also often happens to just connect RX to RX, but it should be RX to TX (receive on one end is transmit on the other) (can also happen the other way round, depending on how people look at it, it's a mess)