Skip to main content
Graduate
May 12, 2025
Question

stm32f769 discovery printf and ITM_SendChar

  • May 12, 2025
  • 1 reply
  • 582 views

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,

    This topic has been closed for replies.

    1 reply

    Graduate II
    May 12, 2025

    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

    KyrpavAuthor
    Graduate
    May 13, 2025

    Which solder bridge do you refer i do not see any comment about a solder bridge for PB3 and SWO in the UM2033
    User manual for the Discovery kit with STM32F769NI MCU i can not find by search or by reading it anything about SWO?

     

    I tried ITM_SendChar outside the printf and it does not print. I saw in debug that the string sent ITM_SendChar is there and the pointer moves one to one to the letters.

     

    Currently the clocks are set like in the screen from Touchgfx. What do you propose to change?

    Kyrpav_0-1747118065479.png

     

     

    I have previously tried to set the ITM->LAR though i was not sure what it does and it did not do anything. Not the ACPR the lar and somethings else. If you can give some correct lines of code i can place them to a function to check if they help.

     

    I have a nucleo board H755ZI and there only by adding the _write function and enabling the asychronous trace sw it works. in this board it does not.

    Thank you.

    KyrpavAuthor
    Graduate
    May 13, 2025


    Discovery kit with STM32F769NI MCU
    Introduction
    The 32F769IDISCOVERY Discovery kit is a complete demonstration and development
    platform for STMicroelectronics Arm® Cortex®-M7 core-based STM32F769NIH6
    microcontroller. It features four I2Cs, six SPIs with three multiplexed simplex I2S,
    2xSDMMC, four USARTs, four UARTs, three CAN buses, three 12-bit ADCs, two 12-bit
    DACs, two SAIs, internal 512+4-Kbyte SRAM and 2-Mbyte flash memory, USB HS and FS
    OTGs, Ethernet MAC, FMC interface, Quad-SPI interface, and SWD debugging support.

     

    The do not have anything else about SWO and they have only 2 pins for the clk and the swdio in the pin explanation. In the ioc at the pin PB3 you can see the function to select and as i said it is automatically set if you select Trach asynchronous SW.

     

    Is it possible that it does not work?