Skip to main content
Visitor II
February 12, 2024
Question

Printf stop working after some time

  • February 12, 2024
  • 1 reply
  • 2329 views

Hello,

After few successful printing using printf and the SWV ITM data console, the console stops showing new data. 

To recreate, I created new project, selected the device I have (STM32H723ZGT6), followed the instructions to enable debugging via printf/SWV ITM and run a sample program that just print every 100msec.

As you can see in the screenshot, the prints halt after 360 lines, although the program still runs and I can place an interrupt and see the program and the counter still progress correctly.

Any idea what can cause the printf to stop working?

Thanks!

 

    This topic has been closed for replies.

    1 reply

    Visitor II
    March 14, 2024

    I'm having the same problem with an STM32H745 Discovery board.  It will print to the data console for about 15 to 20 seconds and then I have to terminate the debug session and restart it before it will work again.  When I step through the _write() function, I see ITM_SendChar() is still being called for each character.  I also verified the ITM registers aren't changing (TER, TPR, TCR, LAR, LSR, PID*, CID*) from when it works to when it quits working.

    Super User
    March 15, 2024

    @jking Try another host software that displays ITM output. CubeProgrammer, or the CubeIDE debugger with OpenOCD backend ?

     

    Visitor II
    March 18, 2024

    Thanks for the suggestion, but I gave up on it because it wasn't going to be my long term solution anyway.  I assigned the output to a serial port on the dev kit instead of the ITM output and haven't had any problems since.