Michael Vaysman
Michael Vaysman

Reputation: 287

UART - wrong symbols on PC

  1. I'm writing a simple program to transmit data from the MCU to the PC.
  2. I'm using FTDI cable to achieve that.
  3. Data that I'm sending is string digits from 0 to 9 (0x30 to 0x39 as ascii codes).
  4. Both the MCU and the PC terminal are configured to 9600 kbps, 8 bits, no parity, no flow control, one stop bit.
  5. When the data transferred from the MCU to the PC - symbols are wrong.
  6. When TX and RX lines of the MCU are both connected to each other - I can see, that all symbols that were sent, were received by the MCU.
  7. When TX and RX lines of the FTDI cable (connected to the PC) are connected to each other - all symbols that were sent from the PC terminal were received by the PC.

I cannot understand what can be wrong in sending data from the MCU to the PC.

Please, help!

Upvotes: 1

Views: 2838

Answers (2)

Michael Vaysman
Michael Vaysman

Reputation: 287

The solution is more simple than I thought. For my previous applications I used the ATC-810 cable (USB-to-UART, FT232BL chip). At the past it worked, but now for some reason it doesn't works. New drivers from FTDI, may be... When I took the TTL-232R-3V3 cable - all data that I'm sending from the MCU I'm receiving on the PC!

Thanks a lot for trying to help!!

Upvotes: 0

Clifford
Clifford

Reputation: 93566

The symptoms you describe suggest a timing mismatch between the PC and the MCU. UART serial comms can tolerate a baud rate mismatch of <5% at either end. In practice because teh PC is certainly accurate, you might get away with up to 10% in the embedded target - but that is extreme. Either the baud rate divisor for your part is incorrectly programmed, or your system clock is inaccurate or simply not the frequency you believe it to be. RC oscillators on some MCUs used to reduce costs can be off-nominal as bad as +/-10%.

You should verify the clock and the baud rate directly with an oscilloscope, or laboriously verify every clock setting from the PLL to the UART baud-rate generator.

Upvotes: 4

Related Questions