cancel
Showing results for 
Search instead for 
Did you mean: 

No traceswo output on stm32H7xx

Florian Otte
Associate II
Posted on March 16, 2018 at 07:40

Hi Forum. I am new to the H7 line of processors and the first thing I tried is getting printf() output on the traceswo pin of my nucleo-H743ZI. What I have tried:

1. The 'Everything out of the box' way:

Use cubeMX to configure sys to async trace, configure clocks, enable master clock out (to verify clock speed with a logic analyser).

Import the project to atollic truestudio and configure debugging to use the SWV, with the specific baudrate and core clock.

Write simples mainloop:

while(1) {

    ITM_Sendchar('T');

 

    delay(xxx);

 

}

 

Start a debugging session, configure trace port 0 and start tracing -> no output in atollic truestudio, no output on PB3 (verified with logic analyser)

2. The 'Do some manual work and hope the rest will resolve' way:

Same as above, with the exception of enabling the ITM unit manually:

CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;

CoreDebug->DEMCR |= CoreDebug_DEMCR_VC_CORERESET_Msk;

 

ITM->LAR = 0xC5ACCE55; // Unlock Lock Access Registers

ITM->TCR |= ITM_TCR_DWTENA_Msk;

ITM->TCR |= ITM_TCR_SYNCENA_Msk;

ITM->TER |= 0x01; // Port 0

ITM->TCR |= ITM_TCR_ITMENA_Msk;

 

Start debug session, enable tracing in atollic studio, THEN call my own init function - since the debugger overwrites the register values -> No traceswo output

3. The 'Do another variation of the non-working example' way:

Same as above, but I let the debugger handle the initialization and have the processor my init code before tracing is enabled through atollic stuido

-> Same result

4. The 'Try to do it by the book' way:

Here I really failed. What I tried:

Configure ITM manually, configure the SWO and SWTF unit manually.

Here my problem is that I do not know where SWO and SWTF are found in memory. The reference manual tells me that I can look up these adresses through the System ROM tables at adress 0xE00E0000.

However acessing these yields a fault -- Have not implemented the different faults, so i can not tell which is the one thats biting my ***! So I thought: Maybe I need to access these in priviledged mode.. same error.

(Atollic truestudio version - if that matters):

Atollic TrueSTUDIO� for STM32, Built on Eclipse Neon.1a.

Version: 9.0.0

Build id: 20180117-1023

Has someone a working example for trace output on the traceswo line on the nucleo-h743zi using atollic truestudio?

Any help or suggestions are apprechiated!

Florian

Addendum:

I received a response from Atollic.

XXXXX XXXXXXX

(Atollic Support)

Mar 16, 09:17 CET

Dear Florian,

There is a known problem with the STM32H7 which we have a ticket for at the moment. We hope to have this fixed until the next release. However, we haven't had a response from the correct ST department just yet if there's a problem with the MCU itself or if we've made a faulty configuration in the software somewhere. We're going to try to reach out again for a response.

Best regards

 

XXXXXX, Atollic Support Team

#atollic-truestudio #itm-swo-trace #nucleo-h743zi
18 REPLIES 18
Posted on May 18, 2018 at 23:27

Like this?

0690X00000604j9QAA.jpg
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 21, 2018 at 13:50

Exactly.

Posted on May 21, 2018 at 14:25

Ok, that didn't seem viable of the STM32H743I-EVAL, didn't see any solder-bridge/jumpers there, will try on NUCLEO-H743ZI later.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Florian Otte
Associate II
Posted on June 19, 2018 at 08:25

Short Bump + a short reminder, that theese issues are not solved.

Looking at you ST. It has been over three months now. The errata sheet from May,2018 does not include a note, or any advisory and the datasheet has not updated since November,2017.

That's very discouraging. Is someone working on it?

Posted on June 19, 2018 at 08:31

Well a mob is starting to assemble

https://community.st.com/0D50X00009XkhURSAZ

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 21, 2018 at 18:38

https://community.st.com/0D50X00009nNBBHSA4

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
FDixo
Associate III

Anyone managed to get link above working (or below if you are upside down)?

It didn't survive the jump to the new forum, currently still exists here

https://st-microelectronics.jiveon.com/docs/DOC-2098-how-to-use-the-swo-on-stm32h7-devices

I condensed it down to this

void SWD_Init(void)
{
  *(__IO uint32_t*)(0x5C001004) |= 0x00700000; // DBGMCU_CR D3DBGCKEN D1DBGCKEN TRACECLKEN
 
  //UNLOCK FUNNEL
  *(__IO uint32_t*)(0x5C004FB0) = 0xC5ACCE55; // SWTF_LAR
  *(__IO uint32_t*)(0x5C003FB0) = 0xC5ACCE55; // SWO_LAR
 
  //SWO current output divisor register
  //This divisor value (0x000000C7) corresponds to 400Mhz
  //To change it, you can use the following rule
  // value = (CPU Freq/sw speed )-1
   *(__IO uint32_t*)(0x5C003010) = ((SystemCoreClock / 2000000) - 1); // SWO_CODR
 
  //SWO selected pin protocol register
   *(__IO uint32_t*)(0x5C0030F0) = 0x00000002; // SWO_SPPR
 
  //Enable ITM input of SWO trace funnel
   *(__IO uint32_t*)(0x5C004000) |= 0x00000001; // SWFT_CTRL
 
  //RCC_AHB4ENR enable GPIOB clock
   *(__IO uint32_t*)(0x580244E0) |= 0x00000002;
 
  // Configure GPIOB pin 3 as AF
   *(__IO uint32_t*)(0x58020400) = (*(__IO uint32_t*)(0x58020400) & 0xffffff3f) | 0x00000080;
 
  // Configure GPIOB pin 3 Speed
   *(__IO uint32_t*)(0x58020408) |= 0x00000080;
 
  // Force AF0 for GPIOB pin 3
   *(__IO uint32_t*)(0x58020420) &= 0xFFFF0FFF;
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

We might have to revisit this on the ST-LINK V3SET and Keil, the V3 is using a 15 MHz SWV clock, not 2 MHz, so the math changes. This was on a 120 MHz L4+ board, so the frequency/multiples might be different in other environments or use cases.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..