cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-H743ZI board and printf / SWO not working

FDixo
Associate III

After implementing this video: https://www.youtube.com/watch?v=BwgPV3uKuzY we expected the printf output to work but for some reason, there is no output.

I checked the SB10 link and it is connected under the board with a 0 ohm resistor.

Any ideas or help would be much appreciated. Thanks

9 REPLIES 9
FDixo
Associate III

I found this link below, Not having a good day (referring to me and ST together)

Confirming here that SWV output working with NUCLEO-H743ZI

<LINK NO LONGER ACTIVE>

FDixo
Associate III

Some good info here. Hopefully closing in on the issue now, hope to have it solved before retirement.

https://community.st.com/s/question/0D50X00009XkWZQSA3/no-traceswo-output-on-stm32h7xx

Mar 16, 09:17 CET

DearXXXX

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

FDixo
Associate III

Currently old forum content can be located here

<LINK NO LONGER ACTIVE>

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..

Here working in Keil via the debug script. The code from the previous post is more effective across different speeds (ie 100-500 MHz), and means you don't have to know the frequency for it to work in the ST-LINK Utilities SWV Viewer, etc.

0690X000006Bs43QAC.jpg

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

Great, thanks for the link and info, Do you know if it is possible to use printf using SWV in Atollic.

Well I'd imagine unless they've done something incredibly brain-damaged, that a) the function would get the clocks/funnel set up right, or b) you could port the script to something workable with OpenOCD.

The serial debug window in Keil above is just the content from the SWV debug channel, I think IAR and Atollic have similar arrangements.

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

OK< thanks for the reply. Not sure what that means or what OpenOCD is.

I have downloaded Keil but cannot even get the ST-Link to work on that.

FDixo
Associate III

OK, it now works well. There were two tricks:

  • Download ST-Link Utility v4 and upgrade ST-Link firmware to the latest V2.J29.M18
  • Set the Core clock to 400MHz

Without the second step, the print out appears as garbage characters (but also means something is working). Thanks for your help. Also have Keil installed now.