Skip to main content
Good B
Associate II
May 14, 2019
Solved

Generated Code form STM32CubeIDE can send text by using printf command except ">"

  • May 14, 2019
  • 4 replies
  • 2184 views

Hi,

I use the STM32CubeIDE to generate the code of STM32L4 Discovery kit IoT node (B-L475E-IOT01A) and I have added code to use printf command. I can send text to HyperTerminal except ">" as code below.

printf("\fSTM32L4 Discovery kit IoT node (B-L475E-IOT01A)\r\n>");

But I tried to use code below. It can send ">".

uint8_t Text1[1] = {'>'};

HAL_UART_Transmit(&huart1,Text1,1,100);

Could you advise me to solve this problem?

Thank you

This topic has been closed for replies.
Best answer by After Forever

Try to use "fflush(stdout);" after the "printf"

Or, alternatively, turn off the buffering by issuing "setbuf(stdout, NULL);" once somewhere before.

4 replies

After Forever
Senior III
May 14, 2019

Put the ">" before "\r\n" :

printf("\fSTM32L4 Discovery kit IoT node (B-L475E-IOT01A)>\r\n");

The standard C I/O implements buffering, you either need to flush the buffer or use the new-line symbol for auto-flush.

Good B
Good BAuthor
Associate II
May 14, 2019

Thank you for your suggestion.

I would like to display ">" on HyperTerminal as below.

STM32L4 Discovery kit IoT node (B-L475E-IOT01A)

>

If I used Keil uVision5. It can use printf("\fSTM32L4 Discovery kit IoT node (B-L475E-IOT01A)\r\n>");

After Forever
Senior III
May 14, 2019

Try to use "fflush(stdout);" after the "printf"

Or, alternatively, turn off the buffering by issuing "setbuf(stdout, NULL);" once somewhere before.

Good B
Good BAuthor
Associate II
May 14, 2019

Thank you for your suggestion.

It works.