cancel
Showing results for 
Search instead for 
Did you mean: 

Hello everyone. I'm having a problem with serial data transmission.

MZarb.1
Associate II

I'm using a STM32L152C-Discovery and a USB-RS232 adapter to receive data via UART protocol from the board. The system clock is 32 MHz and I'm using a baud rate of 115200 and no parity check. To view the messages on the PC, I use Putty configured consistently with the transmission parameters. When I try to send data via HAL_UART_Transmit the serial monitor shows completely different data. In the case of repeted "Hello world" message I get the following result:

0693W00000Y9hTjQAJ.png 

I also thought about low precision clock problems, if this were the case, how can I verify the correctness with the oscilloscope?

12 REPLIES 12
S.Ma
Principal

The onboard debugger (STLink) includes the UART to USB bridge function.

Check the board schematics,

You will need to program the right USART and from USB PC side, set the baudrate correctly on your teraterm-like application.

MZarb.1
Associate II

I need it to work in this mode and I'm trying to track down the problem. In the other case it definitely works.

S.Ma
Principal

If you want to find the rootcause within 30 minutes, use an oscilloscope on TX Pin of the MCU.

Javier1
Principal

>>Putty configured consistently with the transmission parameters

Probably not, which USB-RS232 are you using?

As @S.Ma​  said, just use the UART connected to the stlink, you dont need to connect anything extra.

MZarb.1
Associate II

in fact, I had asked how can I verify this?

yes, putty is set correctly. I'm using the following:

0693W00000Y9hb9QAB.png

I checked, my board doesn't have UART to USB bridge function.

gbm
Lead II

The converter on the photo above uses RS232 levels. You need to use USB-UART "TTL" type converter with 3.3 Volt output, not USB to RS232.

S.Ma
Principal

Check out some boards which are UART CMOS to USB, there was FTDI based kit (and clones), many available on the web. The cable above probably expect a MAX232 voltage shifter...

IMHO I would go directly to HC-05 Serial to Bluetooth Adapter... no wires, no drivers, isolated.