cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769I-DISCO printf() using ITM/SWO

dheerajdake9
Associate III
Posted on February 21, 2017 at 04:53

Hello everyone,

I am trying to redirect printf() to ITM using the tutorial in

https://www.youtube.com/watch?v=BwgPV3uKuzY

 and view the output. I followed the steps as shown in that video but I was unable to see the output because I have a FREE version. I noticed that STM32 ST-LINK utility software also has SWV option. So I tried the following.

1. ST-LINK firmware update (successful)

2. Target connect (successful)

3. Clicked SWV icon

4. Entered 216 MHz in System clock and stimulus port is set to 0

5. Clicked start

I can't see any output here.

My project cubeMX configuration is as follows:

SYS is configured as Trace Asynchronous SW. The rest of the pins are in default state. I am using printf() to print output. 

I connected my board via ST-LINK USB port to my computer. How do I see the printf() output?

I also tried to define a _write function main.c and calling printf() as described in 10_Complementary debug tools - printf.pdf in STM material\USER_MATERIAL\Slides but that didn't help either. Any ideas on how to get this ITM work?

#printf #stm32f7 #gcc
5 REPLIES 5
Imen.D
ST Employee
Posted on February 21, 2017 at 16:24

Hello

Dake.Dheeraj

,

Maybe you shouldcheck yourconfiguration and assignment following your board schematic.

-

http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/7c/c9/c0/5f/4e/9b/44/eb/DM00276557/files/DM002765pdf/jcr:content/translations/en.DM002765pdf

User manual Discovery kit with STM32F769NI MCU

-

http://www.st.com/content/ccc/resource/technical/document/user_manual/65/e0/44/72/9e/34/41/8d/DM000267pdf/files/DM000267pdf/jcr:content/translations/en.DM000267pdf

User manual ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32 (Table 4. JTAG/SWD cable connections )

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on February 21, 2017 at 17:18

Check if there is any solder-bridge configuration on the board impacting the connectivity of PB3 (SWO) to the ST-LINK portion of the board.

Check that the core is actually running at 216 MHz.

On the F7 you may have to enable access to the ITM prior to using ITM_SendChar()

volatile uint32_t *ITM_LAR = (volatile uint32_t *)0xE0000FB0; // ITM->LAR

*ITM_LAR = 0xC5ACCE55; // Enable Access

You could try using the USART/VCP method to output diagnostic information, that's how I'd confirm the internal configuration on the F7 NUCLEO boards.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 22, 2017 at 07:38

Hello Clive,

Thanks for replying. I looked at the schematics and PB3 is connected to SB21. I believe that SB21 connection is already soldered isn't it?

0690X00000606J9QAI.png

I checked the clock configuration in cubeMX and it is as follows. I tried setting the System clock to 16 MHz and added these lines in __write() function. 

volatile uint32_t *ITM_LAR = (volatile uint32_t *)0xE0000FB0; // ITM->LAR

*ITM_LAR = 0xC5ACCE55; // Enable Access

Still I didn't see cannot see any output. I am not sure how you got to these 2 lines above?

0690X00000606N5QAI.png

Regarding this ''

You could try using the USART/VCP method to output diagnostic information, that's how I'd confirm the internal configuration on the F7 NUCLEO boards.

''

In the schematics, the VCP_RX and VCP_TX are connected to PA10 and PA9 respectively. So I configured PA9 and PA10 as USART1_TX and USART1_RX respectively. Then I configured USART1 and was able to print using HAL_UART_Transmit(). I was able to see the output via virtual COM port. 

0690X00000606NAQAY.png

Now how to output the diagnostic information you asked? 

Posted on February 22, 2017 at 07:46

Hello IMEN,

I checked these already. In UM2033, page 20, 6.15 it is said that 'The serial interface USART3 is directly available as a virtual COM port of the PC,'. But according to the schematics, the virtual COM port is connected to USART1(I verified it too). 

Thanks

Dheeraj

jose239955
Associate II
Posted on September 01, 2017 at 19:07

You have to solder R92 (between the the SD card connector and the MCU)