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,

5 REPLIES 5

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

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.


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?

 

I mean check the schematic, some of the DISCO boards have solder bridges in the signal path, I'm saying make sure your board (model/revision) does not

https://www.st.com/en/evaluation-tools/32f769idiscovery.html

https://www.st.com/en/evaluation-tools/32f769idiscovery.html#cad-resources

https://www.st.com/resource/en/schematic_pack/mb1225-f769i-b02_schematic.pdf

Yours has a Resistor and SB21, the default path is too the MicroSD socket SDIO/SDMMC2, needs to be switched over so there is a conductive path for the signal to get into the ST-LINK T_SWO pin

f769ni_disco_swo_pb3.jpg

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

You mean to desolder R92 if you mean this then it is probably impossible in the process I will probably damage the PCB. I will use uart instead if this is the case