cancel
Showing results for 
Search instead for 
Did you mean: 

UART sending some else data and not as intended

rahul7515
Associate II

i am using STM3210e-eval board which has stm32f103zgt6 MCU no i am just sending data over uart to my pc the uart is interfaced with rs232 port so for the looking at the schematics i have connected it's tx and rx to ft232rl's rx and tx respectively and taken the vcc and gnd from the board to the module i have also check the ioc file and it has been set properly asynchronous  mode with 1 stop bit and none parity bit i have also double check the baud rate but i recieve something else on putty now the problem isn't in putty because i checked the data directly over oscilloscope directly from tx pin of mcu and it shows the exact same data as was shown on putty so i guess the mcu is some how converting my data into something else and then sending also it is not random on checking from for all the integers i found out that starting from 1 for all the odd numbers if sent 1 it shows 127 ascii value character and for next odd it decrements to 126 and so on and now for even number it stars at 63 ascii value character and decrements moving further but for all the multiples of 4 it gives nothing that a blank. what is happening?

PS: i have also tried changing the baud rate from 115200 to 9600.... doesn't do any difference

 

here is the code

uint8_t data[1];
data[0] = 10;
HAL_UART_Transmit(&huart1,data,1,HAL_MAX_DELAY);
HAL_Delay(1000);

 

1 ACCEPTED SOLUTION

Accepted Solutions

> the problem isn't in FTDI FT232RL since even on scope without FT232RL it is the same data and if i send 0x55 is shows 0x54 on the scope which as i mentioned earlier is matching with that weird pattern of odd even

As @Tesla DeLorean said, the problem is that you are looking at the signal on the DB9 connector of the EVAL board, *after* a RS232 convertor. RS232 has different levels than 0-3V, and is inverted.

That's why you need a second convertor between the DB9 and FT232RL which inverts again and reverts from RS232 levels to 0-3V.

Or, find the Tx signal directly on the mcu pin (there may be headers on the EVAL board exposing the mcu signals - I am not familiar with this particular board) and connect that to FT232RL.

JW

View solution in original post

12 REPLIES 12
Techn
Senior

Have you tried data[0] = 'a'; example 

VolterPhase
Associate II

Have you properly set your system core clock frequency and USART frequency before enabling the USART and setting the baud rate?

yes i have and still getting something else 

on cubeMX i have selected the board instead of the MCU so by opening it in default peripherals initialized everything is already set besides i am using it in asynchronous mode and i f and i am wrong guide me through it like how to set properly usart frequency and what else to do and how much to set 

> i checked the data directly over oscilloscope directly from tx pin of mcu 

Show.

JW

The DB9 RS232 port is outputting at RS232 levels, best I can tell the FTDI FT232RL is using 3.3V or 5V CMOS levels. These aren't compatible.

You'd need an RS232 compatible dongle, or MAX3232 or equivalent IC to get the levels matched

Output a 'U' / 0x55 pattern, every 1ms, and show that output on a scope, so we can see a couple of characters, and the timing of the bits and bytes.

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

the problem isn't in FTDI FT232RL since even on scope without FT232RL it is the same data and if i send 0x55 is shows 0x54 on the scope which as i mentioned earlier is matching with that weird pattern of odd even

Can you please share the pictur of uart setting ioc? Are you using 8 bit or 9 bits data? 

Screenshot 2024-06-18 142327.png

9 bits and before to you say it i have tried other configuration too with 8 bits also and gotten the same result