cancel
Showing results for 
Search instead for 
Did you mean: 

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

Good B
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

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

View solution in original post

4 REPLIES 4

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
Associate II

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>");

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

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

Good B
Associate II

Thank you for your suggestion.

It works.