2024-06-17 09:48 PM
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);
Solved! Go to Solution.
2024-06-18 02:02 AM
> 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
2024-06-17 10:11 PM
Have you tried data[0] = 'a'; example
2024-06-17 10:15 PM
Have you properly set your system core clock frequency and USART frequency before enabling the USART and setting the baud rate?
2024-06-17 10:30 PM
yes i have and still getting something else
2024-06-17 10:33 PM
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
2024-06-17 11:08 PM
> i checked the data directly over oscilloscope directly from tx pin of mcu
Show.
JW
2024-06-17 11:35 PM
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.
2024-06-18 12:37 AM
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
2024-06-18 12:51 AM
Can you please share the pictur of uart setting ioc? Are you using 8 bit or 9 bits data?
2024-06-18 01:55 AM
9 bits and before to you say it i have tried other configuration too with 8 bits also and gotten the same result