cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f769 discovery printf and ITM_SendChar

Kyrpav
Associate III

I have made an project from touchgfx and opened it from subeide.

The project is loading normally and i have overwritten the write function:

/* USER CODE BEGIN 0 */

int _write(int file, char *ptr, int len)
{
    int DataIdx;
    for (DataIdx = 0; DataIdx < len; DataIdx++){
        ITM_SendChar(*ptr++);
    }
    return len;
}
/* USER CODE END 0 */

in the main default task i have a toggle pin function that works and before the toggle a printf.

i have enabled the SWO from the debugger configuration and the clock is exactly as in the ioc file 216Mhz
When opening the debugger i select port 0 in the SWV console. The system has by itself a prescaller to 108 which i can not edit and the SWO clock is 2000.

There is nothing printed in the port 0 . I have placed an interupt in the function above to ensure that printf really calls the write function. This is true it uses the write function but ITM_SendChar does not do anything,

1 REPLY 1

Make sure there's not a Solder Bridge you need to make for PB3/SWO pin

Use STM32 Cube Programmer SWV Viewer, or that of the ST-LINK Utilities

Try the ITM_SendChar() outside of printf()

Try running the STM32F7 from HSI, and use THAT clock frequency.

Check ITM TCR / TER bits, perhaps unpack the SWO baud divider

 

printf("\n\nCore=%d, %d MHz\n", SystemCoreClock, SystemCoreClock / 1000000);

TPI->ACPR is the divider on the CM7's = (SystemCoreClock / (SWCLK * 2)) - 1 if I recall

ITM->LAR = 0xC5ACCE55; // Unlock on the CM7's

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