2018-04-21 04:38 AM
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-uart2018-04-21 08:10 AM
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.
2018-04-21 10:49 AM
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?2018-04-21 12:33 PM
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.
2018-04-21 01:01 PM
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.
2018-04-21 01:40 PM
But how did you verify it?
2018-04-21 01:47 PM
I checked settings of baud rate and stop bit and parity at both the end the system was working Fine when same code was run at STM32F103C8T6 but it was throwing garbage value at STM32F103RBT6
2018-04-21 02:19 PM
Send repetitive 'U' pattern and verify data and bit timing with a scope. Look to be using HSI so shouldn't have issues related to HSE_VALUE
USART1 PA9/PA10
USART2 PA2/PA3
Not familiar with the specific board or wiring being used, if you exhaust options with software look more closely at the hardware.
2018-04-21 03:56 PM
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.
2018-04-22 09:08 AM
The OP attached source code, sending ASCII strings.