Skip to main content
Prasad Dait
Associate II
April 21, 2018
Question

STM32F103RBT6 UART is sending garbage data

  • April 21, 2018
  • 3 replies
  • 5037 views
Posted on April 21, 2018 at 13:38

 I am Working on STM32F103RBT6 and need to implement UART in my Requirement. I tried Using UART1 and UART2 Both individually on my code to send character data  'Hi I am Working ' to the PC. But Every time UART is sending garbage data. I tried sending via different UART but both time the data received at PC End was garbage value. There was one thing constant and it is that the garbage value was constant it was not changing on both UART. But when I change Transmission data the garbage value changes to and it was still constant on both UART.

      I am using ST Standard HAL Library Functions and using CubeMx To generate code. The Zip file of Code is attached Below. IN this file I have initialized both the UART and sending data on one at a time.

   Thank You..

   If anyone have STM32F103RBT6 Nucleo board please verify the code given below and check whether the output obtained or not. The project is  true studio project.

https://community.st.com/tags♯/?tags=stm32f1%20uart

‌  

https://community.st.com/tags♯/?tags=stm32f103rbt6

‌ 

‌

#stm32f103rbt6_uart #stm32f103rbt6 #stm32f1-uart
This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
April 21, 2018
Posted on April 21, 2018 at 17:10

The STM32 outputs CMOS levels, these aren't directly compatible with RS232 levels expected by a PC port, you'd need a MAX3232 type translator chip.

Perhaps you could diagram exactly how you have this wired up, and review signals with a scope.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Prasad Dait
Associate II
April 21, 2018
Posted on April 21, 2018 at 19:33

I am using  USB to serial converter for this operation instead of RS232. And this converter is working properly. I have tried same operations on STM32F103C8T6 and it is working properly so this is surely not causing any problem to communication.

Andrew Neil
Super User
April 21, 2018
Posted on April 21, 2018 at 19:49

UART is sending garbage data

Or the PC is failing to recognise what the UART is sending?

The most common reason for seeing garbage data like this:

https://learn.sparkfun.com/tutorials/serial-communication

is that your baud rate is wrong.

So, as

Turvey.Clive.002

‌ said, what have you done to verify your baud rate?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Prasad Dait
Associate II
April 21, 2018
Posted on April 21, 2018 at 20:01

Initially I thought this is a baud rate issue but Device baud rate and Baud Rate set By PC is verified Twice and it was correct I have also checked stop bit, Parity and  Data length and crosschecked but it was still providing error value. I have checked the data received at MCU end on Attolic Truestudio and it was also receiving garbage value and sending one too.

Andrew Neil
Super User
April 21, 2018
Posted on April 21, 2018 at 20:40

But how did you verify it?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Brian D
Associate III
April 21, 2018
Posted on April 22, 2018 at 00:56

We're you sending hex or ascii bytes? Pc will not display hex correctly. Just try to send '1' char repeatedly and the scope should show 8bit number 0x31, and verify the bit rate also.

Tesla DeLorean
Guru
April 22, 2018
Posted on April 22, 2018 at 16:08

The OP attached source code, sending ASCII strings.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..