Skip to main content
ADain.1
Associate II
March 9, 2020
Question

Hello Community!! I am trying to send string to UART but it's not transmitting.I am using STM32F030R8T6 Valueline board.However when I am transmitting single char or decimal value it's going.

  • March 9, 2020
  • 8 replies
  • 7584 views
  1.  

sprintf(buffer,"Hello\r\n");

 len=strlen(buffer);

 HAL_UART_Transmit(&huart1,(uint8_t *)buffer,strlen(buffer), 0xFFFF);

 HAL_Delay(100); // just in case required delay is given

2.

ch=83;

  HAL_UART_Transmit(&huart1, &ch, 1, 50);

  HAL_Delay(1);

  ch=87;

  HAL_UART_Transmit(&huart1, &ch, 1, 50);

  HAL_Delay(1);

  ch=73;

HAL_UART_Transmit(&huart1, &ch, 1, 50);

HAL_Delay(1);

ch=84;

HAL_UART_Transmit(&huart1, &ch, 1, 50);

HAL_Delay(1);

ch=67;

HAL_UART_Transmit(&huart1, &ch, 1, 50);

HAL_Delay(1);

ch=72;

HAL_UART_Transmit(&huart1, &ch, 1, 50);

HAL_Delay(1);

ch=49;

HAL_UART_Transmit(&huart1, &ch, 1, 50);

HAL_Delay(1);

If multiple single decimal's/char's were transmitted delay is required minimum 1 ms.

Kindly help me on this!!!!!!!!!!!!!!!

This topic has been closed for replies.

8 replies

AKSHAY1
Visitor II
March 9, 2020

sprintf(buffer,"Hello\r\n");

HAL_UART_Transmit(&huart1,(uint8_t*)buffer,strlen((const char*)buffer),10);

just try this..

ADain.1
ADain.1Author
Associate II
March 9, 2020

This is not working...Only first character is getting transmitted followed by garbage value

March 9, 2020

Hello,

The string that you are looking to send contain 7 characters, Kindly verify the size of the buffer, and reduce the delay from 0xFFFF.

char buffer [10] = "hello\r\n";

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

Hope that will help!

ADain.1
ADain.1Author
Associate II
March 9, 2020

Same with this.......Only first character is getting transmitted followed by garbage value

waclawek.jan
Super User
March 9, 2020

What receiver are you using?

What is the hardware connection between the STM32 and receiver?

What are the baudrate etc. settings?

Do you use a crystal/HSE on the STM32?

Have you observed the waveforms using oscilloscope/logic analyzer?

JW

ADain.1
ADain.1Author
Associate II
March 10, 2020

I am reading it through max3232 . Connection was done through jumper cable.

Baud Rate is 9600, Word length is 8 bit with non parity bit, Stop bit is 1, I am using HSI with x12 PLL,sysclk is 48MHz.

I did not observed waveforms yet...