Hello!
I'm trying to get the ITM 'printf' functionality working on a Cortex-M3 (STM32F103ZE, running at 72Mhz) with a J-Link Ultra, using SWV mode.
The following code is used to enable the ITM output via TPUI:
Display All
I'n not sure about the following settings:
Can anybody help in getting this to work, and is there some way to display the captured SWO data as ASCII, instead of HEX-dump?
Thanks!
I'm trying to get the ITM 'printf' functionality working on a Cortex-M3 (STM32F103ZE, running at 72Mhz) with a J-Link Ultra, using SWV mode.
The following code is used to enable the ITM output via TPUI:
C Source Code
- const char mystring[] = "Hello world";
- char* s;
- CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk;
- *((uint32_t*)0xE0040010) = 12; //Async Clock Prescaler Register
- *((uint32_t*)0xE0040304) = 0; //Formatter and Flush Control Register
- *((uint32_t*)0xE00400F0) = 1; // Selected Pin Protocol Register
- DBGMCU->CR = 0x00000020; // Set asynchronuous communication via DBGMCU_CR
- ITM->LAR = 0xC5ACCE55;
- ITM->TCR |= ITM_TCR_ITMENA_Msk | ITM_TCR_SYNCENA_Msk | (1UL << ITM_TCR_ATBID_Pos);
- ITM->TER |= 1UL;
- ITM->TPR |= 1UL;
I'n not sure about the following settings:
- Prescale register (72Mhz/12 = 6Mhz, the same as the J-Link, right?)
- Formatter and flush control register
- Protocol register (1 == manchester encoded, 2 == NRZ)
- Maybe some more settings
After trying several settings, the above code at least returns some data, although its not what I expect...J-Link>sworead
1 bytes read (1 bytes in host buffer)
00000000 = 00
Can anybody help in getting this to work, and is there some way to display the captured SWO data as ASCII, instead of HEX-dump?
Thanks!