cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769 Disovery ITM_SendChar

Chris Lynch
Associate III
Posted on March 05, 2018 at 15:46

Hi

 I am using Atollic studio and the STM32F769 Discovery board.

I removed resistor R93 and fitted a 0R link to R92 so that the SWO line is connected to the ST-Link on the discovery board.

I have followed this tutorial to enable SWV and make use of ITM_SendChar:

http://blog.atollic.com/cortex-m-debugging-printf-redirection-to-a-debugger-console-using-swv/itm-part-1

 

I have enabled SWV and set the core clock frequency: currently 200MHz. (I verified this by calling SystemCoreClockUpdate() and checking the value of SystemCoreClock 200000000)

I have set the SWO clock to 2000kHz.

Unfortunately i do no receive any characters in the SWV console window within Atollic.

If i breakpoint the ITM_SendChar function i can see that its getting to the line 'ITM->PORT[0U].u8 = (uint8_t)ch;' without issue.

I also just tried the 'STM32 ST-Link Utility' with SWO viewer and can see a few characters when I press start but do not see a continuous stream of characters as i expect.

Anyone have a suggestion?

Thanls

Chris

13 REPLIES 13
Posted on March 05, 2018 at 18:21

Ok, so not exactly an oranges-to-oranges comparison, I did bring up one of the Nucleo-F767ZI boards where I output to the USART and SWV, no mag-ic incantations involved.

0690X00000604IsQAI.jpg

//****************************************************************************

// Hosting of stdio functionality through USART

//****************************************************************************

/* Implementation of putchar (also used by printf function to output data)    */

int SendChar(int ch)                    /* Write character to Serial Port     */

{

♯ if 0

  ITM_SendChar(ch); // From core_cm4.c

♯ else

  OutChar((char)ch);

  ITM_SendChar(ch); // From core_cm4.c

♯ endif

  return(ch);

}

volatile int32_t ITM_RxBuffer;

//****************************************************************************

void OutChar(char c) // USART_RS232 is USART3, PD8/PD9

{

  while((USART_RS232->ISR & USART_ISR_TXE) == 0); // Wait for Empty

  USART_RS232->TDR = c; // Send Char

}

//****************************************************************************

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Chris Lynch
Associate III
Posted on March 05, 2018 at 19:31

          The firmware version I had on the ST-LInk was V2.J30.M19 but it seems to have issues with SWO.

  

          I just reverted back to V2.J29.M18 and SWO is now working fine

        

          Follow up:

                  In case anyone is interested I just updated the ST-Link firmware to the Segger J-Link firmware which allows me to use 'Live Expressions' within Atollic studio:

https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/

 
Pavel A.
Evangelist III
Posted on March 05, 2018 at 20:31

@Chris Lynch, do the characters you see resemble what you print?

-- pa

Posted on March 06, 2018 at 09:31

Pavel, 

           Thanks for asking.

            Yes they did, but i only received about 4 characters when i should have received a character every 100ms.

           See my answer above regarding the ST-Link firmware as the actual problem.

Chris