cancel
Showing results for 
Search instead for 
Did you mean: 

stm32g474ceux - printf() works only once with USB -CDC_Transmit_FS() - Buffering issue

mdudhat
Associate III

Hi all.

I am using printf() in my USB-CDC VCP based stm32cubeide project, for printing the messages via USB to the serial terminal. But it prints only once in CDC_ReceiveCallBack () function and then i do not see other messages printed. In fact in while loop (in main function), i get all printf function results (all messages getting printed on serial terminal).

Moreover, I tried to use flush function - fflush(stdout)  after printf() function, but the result is the same..May be i did not use it properly.?

Can anyone please help me out for this. ?

Many thanks in advance,

10 REPLIES 10

Hi @AScha.3, thanks.

but i already said in one of my previous answer that i am getting all these printed messages from different printf() statements,  only in while loop. that i do not want to print continuously. so my attempt was to do it once during the callback function execution.