cancel
Showing results for 
Search instead for 
Did you mean: 

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.

ADain.1
Associate II
  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!!!!!!!!!!!!!!!

8 REPLIES 8
AKSHAY1
Associate

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

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

just try this..

Muhammad Moiz khan
Associate II

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!

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

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

0693W0000000KPEQA2.png

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

Not working ...

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...