I’m trying to output data through the SWO but I don’t even see anything happening on the PB3 pin using an oscilloscope.
I don’t want to use semihosting, and I don’t even need printf to work either. I simply want to output chars on the SWO line. I’ve read dozens of posts on this forum and others, and as many suggest I’m simply calling
ITM_SendChar(uint32_t ch), but it doesn’t do anything. More precisely, if debugging with checkpoints, I can see that the following check in this function doesn’t pass:
if ((ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */
(ITM->TER & (1UL << 0))) /* ITM Port #0 enabled */
is always false. So it makes me think something is maybe not initialized correctly? By the way I’m not using code generated by CubeMX, is there anything I should do to allow SWO (ITM) to be used?
My process for testing is to launch debugging inside System Workbench for STM32, start the code, and then stop it, open the ST-LINK Utility “Printf via SWO viewer” and start it with my system clock (168000000 Hz, I’m on a stm32f405rg). I double checked that the PB3 pin is connected to the SWO header pin on my STLINK-V3. As mentioned, I’m also monitoring the PB3 pin with an oscilloscope, but nothing happens on it at any time during the process.
What am I doing wrong?