Skip to main content
karthik.arunachalam
Associate
November 6, 2018
Question

How to redirect Printf to SWV Console in TrueStudio?

  • November 6, 2018
  • 12 replies
  • 3950 views

I have followed step-by-step set up as explained in http://blog.atollic.com/cortex-m-debugging-real-time-variable-watch-using-swv/swo but it didnt work for me. I get sometimes some random characters printed on the SWV console.

My setup:

IDE: TrueStudio

Hardware: NUCLEO-F410RB

Programmer: On-board ST-Link

Let me know if you need further details.

    This topic has been closed for replies.

    12 replies

    Tesla DeLorean
    Guru
    November 6, 2018

    Try testing more directly with ITM_SendChar()

    Most common mode of failure is having the WRONG clock settings. ie Core and Trace settings disagree

    Try using the VCP/USART to output SystemCoreClock.

    Try using the SWV console in the ST-LINK Utilities.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    karthik.arunachalam
    Associate
    November 6, 2018

    I tried with ITM_SendChar directly, same issue still. My core clock is 96MHz, SWO clock is set to 1000kHz.

    Tesla DeLorean
    Guru
    November 6, 2018

    In Keil and ST-Link Utilities you'd need to set the Core clock as being 96 MHz, sorry not using Atollic.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    karthik.arunachalam
    Associate
    November 6, 2018

    This is how i am setting up the interface.

    0690X000006CKIuQAO.png

    Tesla DeLorean
    Guru
    November 6, 2018

    Double check the SWO solder bridges on the board.

    Check if the debug output is visible using ST-LINK Utilities SWV Window

    Try running the board from the HSI directly, at 16 MHz, without the PLL, ie don't call SystemClock_Init()

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    karthik.arunachalam
    Associate
    November 6, 2018

    SWO solder bridge has 0 ohm installed.

    i changed the clock source to internal, now its working. thanks for the suggestion. i need to find out why it is not working with external 6MHz crystal...

    Tesla DeLorean
    Guru
    November 6, 2018

    Probably because it's not actually running a 96 MHz.

    You'd need to change the HSE_VALUE in stm32f4xx_hal_conf.h and the PLL settings in the SystemClock_Init(), and have everything coherent from hw/sw sides.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    karthik.arunachalam
    Associate
    November 6, 2018

    When i generate the code from CubeMX it takes care of that, right?

    Tesla DeLorean
    Guru
    November 6, 2018

    I suppose, but you're telling me things aren't working, what should I deduce?

    Trust but Verify...

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    karthik.arunachalam
    Associate
    November 6, 2018

    ok, i checked that

    0690X000006CKJ9QAO.png

    karthik.arunachalam
    Associate
    November 6, 2018

    I dont understand... now it works even with the external crystal.

    karthik.arunachalam
    Associate
    November 6, 2018

    Please ignore my previous comment, the wasnt cleaned up so it was working with HSI not with HSE.

    MFend
    Associate III
    July 21, 2019

    Is there such an article for STM32CubeIDE?

    Now that I've migrated to STM32CubeIDE from Atollic TS, I can't get the SWV console to show printf messages.

    MFend
    Associate III
    July 26, 2019

    The SWV ITM Data Console is working!

    In Debug Mode - choose Window -> Show View -> SWV -> SWV ITM Data Console

    When the SWV is opened, choose configure (wrench/screwdriver icon) and make sure that Hz rate is correct (can be set in Debug dialog when connecting with ST-Link or Segger-Link) - and check Port 0 (towards bottom of screen on far right - see attached.

    MFend
    Associate III
    July 26, 2019

    ..

    Pavel A.
    Super User
    July 21, 2019

    @MFend​  Please see this thread. No replies yet... so ...