2023-01-24 06:40 AM
Hi!
I have a problem setting up Serial Wire Output over ITM. I followed every tutorial on the Internet (including this forum) and I still haven't made any progress.
I run the MCU on 280 Mhz:
In Pinout & Configuration -> DEBUG I configured Serial Wire as debug interface.
I've implemented my own _write() function as below:
int _write(int file, char *ptr, int len) {
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++) {
ITM_SendChar(*ptr++);
}
return len;
}
Next I just call printf inside some loop in main():
while(1) {
printf("counter = %d\n", counter++);
delay = 280000;
while(delay--);
}
My debug configuration looks like this:
And my SWV ITM configuration looks like this:
Please help me figure out how to get it up and running, because I'm getting frustrated after all my failures in tutorials.
Regards,
Piotr
2023-01-24 06:59 AM
Hello @ypiotrp (Community Member)
"In Pinout & Configuration -> DEBUG I configured Serial Wire as debug interface."
You must set Trace Asynchronous SWO with PB3 as JTDO-SWO.
Regards,
Romain,
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-24 09:22 AM
Hi Romain,
I tired also this option but the result was the same - empty SWV ITM Data Console. Have you got any other idea?
Regards,
Piotr
2023-01-24 10:50 AM
i tried many hours, until i see something... so dont be surprised to get nothing at first.
(is buggy, not really reliable ; but when working, is very useful... )
2023-01-25 12:09 AM
2023-01-25 12:33 AM
What's more my _write() function implementation gets called properly and in consequence ITM_SendChar().
2023-01-25 03:19 AM
> 6. yes, the ITM Data Console (i opened also time line dia. and Statistic Profiling )
> 7. ok. sometimes it dont start working, need open cofiguration, close it, > red button, change window to Profiling , > red button, change back to DataConsole , > red button ; debug > run , then it working;
funny: stop debug, modify program, compile, debug -> ITM Data Console still /again working ! (as been set on last debug session..)
2023-01-25 05:29 AM
@Community member Have you already used the SWO printf redirection with any other STM32 (to make sure you know how to set it up and start SWO console in the debugger)?
IIRC the STM32H7A/B family has some subtle difference in ITM settings, compared with older STM32H7. Do you use the latest CubeIDE?
@AScha.3 This issue already has been reported to ST, they should be working on a fix. @Markus GIRDLAND ?
2023-01-25 10:47 AM
this is, what comes from USB host , with debug on:
+ i didnt click red button or anything, still setup is running like i set it 3 days ago , on last debug of this project.
2023-01-25 11:59 PM
To be honest I haven't done it before, this is my first time.
But I took some Nucleo-F429ZI from my drawer and gave it a try. It worked like a charm in both scenarios - using embedded STLinkV2 and an external one I'm using for my custom board. It looks like I can set it up properly :beaming_face_with_smiling_eyes:
Can you tell me something more about these 'subtle difference'?
Regards,
Piotr