cancel
Showing results for 
Search instead for 
Did you mean: 

printf on STM32H747 core M4 doesn't work

CHossack
Associate III

printf works on the STM32H747 M7 core once I add the following code

int _write(int file, char *ptr, int len)
{
    int i =0;
    for ( i = 0 ; i < len; i++)
    {
        ITM_SendChar((*ptr++));
    }
    return len;
}

and enable the "SWV" in the debugger configuration and configure the "SWV ITM Data Console".

But when I perform the same steps for the M4 core I don't see any outputs. Is there anything else I need to do?

cheers

Chris

3 REPLIES 3
TDK
Guru

Are you connecting via the M4's access port 3? I would guess ITM is core specific, although I'm not sure.

If you feel a post has answered your question, please click "Accept as Solution".
CHossack
Associate III

Hi,

I'm connecting with the M4 access port 3. I think each core has it's own ITM as shown below. There's a MUX for the SWO that's controlled with SWFT_CTRL:ENS0/1, but when I manually changed that it still didn't work.

0693W00000BcbQuQAJ.pngcheers

Chris

CHossack
Associate III

I managed to get trace working from the M4. I had to set the SWV - Core Clock: setting to the M7 clock speed and not the M4 clock speed.

If you enable trace logging from one core the IDE wont allow you to enable the 2nd core. If you get in this situation you need to power cycle the board.

But after some more playing it appears the correct M7 Core clock value is taken from PLL1R (DIVR1) output, but I can't see anything that talks about this. Also if PLL1R isn't enabled (as in my first example) then it's the M7 SysClk value.

I feel I'm just having good guesses at the SWV Core Clock value. What I really need is the correct way to find the SWV Core clock value.

cheers

Chris