This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32 and ITM Viewer

I'am using the STM32 and tried to use the ITM-Viewer. At the Keil documentation "Using the ITM Viewer" is a code example of the fputc() function.

int fputc(int ch, FILE *f) {
  if (DEMCR & TRCENA) {
    while (ITM_Port32(0) == 0);
    ITM_Port8(0) = ch;
  }
  return(ch);
}

This function call will end at a hardware fault. The check if the trace is activated ( if (DEMCR & TRCENA) { )seems to be the source of this hardware fault. If I keep a way this check the ITM Viewer is working fine. Does anybody know, if I have to be at privileged mode to have access to the DEMCR register?

Thanks for help.

0