2021-05-20 02:14 AM
I'm using a 32F469IDISCOVERY board (Cortex-M4). The integrated ST-Link V2-1 has firmware V2J37M27 and is configured as "Debug + Mass storage + VCP Modus" (default). It doesn't look like it has a jumper or solder bridge to connect SWO and I think it's permanently connected to ST-Link.
I create an new empty project in STM32CubeIDE v1.6.1
void Delay (__IO uint32_t nCount)
{
while (nCount--)
{
}
}
and call it in the endless loop, toggle orange LED:
while (1)
{
/* USER CODE END WHILE */
HAL_GPIO_TogglePin (LED2_GPIO_Port, LED2_Pin);
ITM_SendChar ('x');
Delay (1000000L);
/* USER CODE BEGIN 3 */
}
[x] Enable
Core Clock 16MHz
SWO Clock: 2000 kHz
Port number: 61235
[x] Wait for sync packet
Tab "SWV ITM Data Console"
Configure Trace:
Timestamps
[x] Enable Prescaler 1
ITM Stimulus Ports
[x] 0
-> Ok
Port 0 shows up
-> red filled "record" circle (Start Trace)
F8 (Resume)
Orange LED (LED2) starts to blink but
SWV Trace Log, SWV ITM Data Console, SWV Statistical Profiling keeps empty.
I've checked DGBMCU_CR and it's 0xe0042004 so
TRACE_IOEN = 1
TRACE_MODE = 00: TRACE pin assignment for Asynchronous Mode
chapter 37.14.2 of the STM32F469xx reference manual says
0xC5ACCE55 has to be written @E0000FB0 but I'm unsure if this shouldn't be done from the debugger.
dm00354244-stm32-microcontroller-debug-toolbox-stmicroelectronics.pdf
doesn't even mention it but I also tried
volatile uint32_t *ITM_LAR = (volatile uint32_t *)0xE0000FB0; // ITM->LAR
*ITM_LAR = 0xC5ACCE55; // Enable Access
but this doesn't change anything.
I'm really running out of ideas here. Can someone help me?
Thank you, Andy
2021-11-06 02:07 AM
This is ITM example with printf float via ITM.
Also "Output gets flushed on reaching newline character or calling fflush(stdout) function. Additionally there is an option to disable buffering entirely by calling setbuf(stdout, NULL)."
main source: AN4989
see also
1) https://youtu.be/sPzQ5CniWtw
2) https://habr.com/ru/post/440024/
3) http://www.embedded-communication.com/en/misc/printf-with-st-link/
4) https://www.youtube.com/watch?v=Efgp34LbkLU
2023-10-06 12:32 AM
The SWO isn't configured or soldered by default, make sure in cubeMX that the SWO is configured (which it looks like you have done). Then close the solder bridge SB7 and the SWV should work.
I had the same issue and this fixed it for me.