Skip to main content
FLine.1
Associate II
June 5, 2020
Question

Sending UART issue

  • June 5, 2020
  • 3 replies
  • 4503 views

Hello

I wrote UART sending command. I use cp210x from Silicon labs.

But i didnt see numbers in putty or termite .

Please tell me what is wrong ?

[url=https://hizliresim.com/dABfK1[/url]

My code:

My code:

#include "string.h"

char com_giden[50];

int ix = 0;

 sprintf(com_giden,"merhaba dunya : %d\r\n",ix++);

    HAL_UART_Transmit(&huart1,(uint8_t*)com_giden,strlen(com_giden),10);

my usb ttl:

https://www.gittigidiyor.com/ev-elektronigi/cp2102-usb-to-ttl-com-cevirici-adaptor-5124p-seri-donusturucu-karti-arduino-rs232-convertor_pdp_501510386

    HAL_Delay(500);

[url=https://hizliresim.com/evmd6T[/url]

[url=https://hizliresim.com/5q35Sh[/url]

This topic has been closed for replies.

3 replies

TDK
Super User
June 5, 2020

The most common issues with UART not working are probably incorrect clock settings and uninitialized or incorrectly initialized pins.

I don't see anything wrong with the code you posted. A logic probe can help debug things immensely.

"If you feel a post has answered your question, please click ""Accept as Solution""."
FLine.1
FLine.1Author
Associate II
June 6, 2020

Dear TDK

You are right. I had mistake in clock configuration.

I think that I dont find out how i have to set clock configuration.

Please see tthose pictures. and pls tell me what is wrongin clock settings. about pll clock.

This pic is sample setting for STM32F103C8T6:

[url=https://hizliresim.com/Pex4Ts[/url]

This picture UART is not working via clock configuration:

[url=https://hizliresim.com/OuI[/url]

This pictre UART is working perfectly:

[url=https://hizliresim.com/zC5ml9[/url]

Please advice me how can i set clock configuration .

sincerely.

TDK
Super User
June 6, 2020

Your images do not show up.

STM32CubeMX can be used to generate clock settings for you.

"If you feel a post has answered your question, please click ""Accept as Solution""."