2018-03-05 06:46 AM
Hi
I am using Atollic studio and the STM32F769 Discovery board.
I removed resistor R93 and fitted a 0R link to R92 so that the SWO line is connected to the ST-Link on the discovery board.
I have followed this tutorial to enable SWV and make use of ITM_SendChar:
I have enabled SWV and set the core clock frequency: currently 200MHz. (I verified this by calling SystemCoreClockUpdate() and checking the value of SystemCoreClock 200000000)
I have set the SWO clock to 2000kHz.
Unfortunately i do no receive any characters in the SWV console window within Atollic.
If i breakpoint the ITM_SendChar function i can see that its getting to the line 'ITM->PORT[0U].u8 = (uint8_t)ch;' without issue.I also just tried the 'STM32 ST-Link Utility' with SWO viewer and can see a few characters when I press start but do not see a continuous stream of characters as i expect.
Anyone have a suggestion?
Thanls
Chris
Solved! Go to Solution.
2018-03-05 10:31 AM
The firmware version I had on the ST-LInk was V2.J30.M19 but it seems to have issues with SWO.
I just reverted back to V2.J29.M18 and SWO is now working fine
Follow up:
In case anyone is interested I just updated the ST-Link firmware to the Segger J-Link firmware which allows me to use 'Live Expressions' within Atollic studio:
https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/
2018-03-05 07:48 AM
I currently use the SDMMC on the F769I-DISCO so not looking to modify mine, consider using the VCP USART as the diagnostic/telemetry output channel. USART1 PA9/PA10
On the Cortex-M7 it might be necessary to unlock access to the ITM.
Will experiment on an F767ZI-NUCLEO
2018-03-05 08:00 AM
Clive,
Thanks for the response.
I would like to get ITM going as it will be useful for debugging during development and i can also use it on production boards without needing an extra connector.
I tried unlocking and setting the ITM directly: (code found in another forum) but no change.
void SWO_Init(uint32_t portBits, uint32_t SysClkHz)
{ uint32_t SWOSpeed = 2000; // 2M baud rate uint32_t SWOPrescaler = (SysClkHz / SWOSpeed) - 1; // SWOSpeed in Hz, note that cpuCoreFreqHz is expected to be match the CPU core clock*((volatile unsigned *) 0xE000EDFC) = 0x01000000; // 'Debug Exception and Monitor Control Register (DEMCR)'
*((volatile unsigned *) 0xE0042004) = 0x00000027; //DBGMCU_CR register: Enabling TRACE_IOEN, DBG_STANDBY, DBG_STOP, DBG_SLEEP *((volatile unsigned *) 0xE00400F0) = 0x00000002; // 'Selected PIN Protocol Register': Select which protocol to use for trace output (2: SWO) *((volatile unsigned *) 0xE0040010) = SWOPrescaler; // 'Async Clock Prescaler Register'. Scale the baud rate of the asynchronous output *((volatile unsigned *) 0xE0000FB0) = 0xC5ACCE55; // ITM Lock Access Register, C5ACCE55 enables more write access to Control Register 0xE00 :: 0xFFC *((volatile unsigned *) 0xE0000E80) = 0x0001000D; // ITM Trace Control Register *((volatile unsigned *) 0xE0000E40) = 0x0000000F; // ITM Trace Privilege Register *((volatile unsigned *) 0xE0000E00) = portBits; // ITM Trace Enable Register. Enabled tracing on stimulus ports. One bit per stimulus port. *((volatile unsigned *) 0xE0001000) = 0x400003FE; // DWT_CTRL *((volatile unsigned *) 0xE0040304) = 0x00000100; // Formatter and Flush Control Register}The fact that i got a few characters in the
'STM32 ST-Link Utility' suggests it should work but I have some setup issue. I keep thinking its clock related but the
SystemCoreClockUpdate() reports the correct core clock frequency.
Chris
2018-03-05 09:05 AM
I have noticed that you use term 'telemetry' a lot in the context of debugging. Also in computer network the term is really popular nowdays as the telemetry is a part of modern network - to see what is going on the datapath (BTW. the datapath comes probably from the MCU/CPU and RTL-based design but in the last few years is heavily (over)used in computer network world).
So it seems that the terminology becomes common between these two Worlds.
I know the comment is out of the scope of this post. Sorry if someone may consider it a noise.
2018-03-05 09:35 AM
I see it as real time output of system state, like monitoring data thrown off by an engine or machine in motion.
Telemetry is the data the system is working with to make the decisions and responses you see, in that sense it is a window into the black-box you have created. This allows you to see if the measurements it is working on make sense, and if the math/computations applied result in the expected answers. The system is likely to be throwing this information out dealing with the instant, but it is very useful for analysis after the fact to either recreate the situation, or understand it more fully.
I use this type of output to understand the flow and interaction in dynamic and active systems. There are lots of issues where you can't dead-stop the system and hope to understand what's happening, and there are plenty of cases where stopping a machine in this way will cause physical damage and destruction.
I don't need to single-step code to understand the logic I have written, and a human can't interact with a machine quick enough to not break millisecond expectations of the peripherals. The time dilation is invasive.
Some people buy expensive trace hardware to find out how it got down a particular path of execution/logic, but I'd rather instrument a system so an end-user can log things, or I can run a dozen systems without $30K of equipment attached to them. ARM's trace is also interesting because it doesn't log register level data, but rather logs hints so the flow/data can be reconstructed later via analysis/emulation. This can be an issue if you can't 100% recreate the system as built and running.
2018-03-05 09:40 AM
Clive,
Thanks for trying it, glad it worked for you .
Ill keep trying, i must have something wrong, somewhere.
If i manage to get it working ill post details back here in case it helps someone else.
Chris
2018-03-05 09:45 AM
Attached is an example that should output via VCP USART and SWV at 200 MHz
I've removed the code touching the SDMMC, but it does initialize the screen. It should allow for SWV provided SWO is connected all the way through to the ST-LINK
Core=200000000, 200 MHz
CPUID 411FC270 DEVID 451 REVID 1000 Cortex M7 r1p0 STM32F76xxx or F77xxx C0000000 FFFFFFF8 00000000 10110221 12000011 00000040 FPU-D Single-precision and Double-precision APB1=50000000 APB2=100000000 800 x 480 PLL P:200000000 Q: 50000000 R: 57142857 SDCLK 25000000, 00 MHz PLLI2S P: 96000000 Q: 96000000 R: 96000000 PLLSAI P: 96000000 Q:192000000 R: 54857142 LCDCLK 27428571, 43 MHz DSIPLL 500000000, 500.00 MHz lbClk 62500.000 KHz TXEscape 4.001280 Infinite loop... ________________ Attachments : F769IDISCO_SWV_200MHZ_001.HEX.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxvG&d=%2Fa%2F0X0000000b2G%2FXrkXXHvyNXbscPtvAgDVHUnzofGXaYrsgg0TJXxYhV8&asPdf=false2018-03-05 09:46 AM
See this also
https://community.st.com/0D50X00009XkgXgSAJ
I tend to output this sort of data
Core=200000000, 200 MHz
CPUID 411FC270 DEVID 451 REVID 1000Cortex M7 r1p0STM32F76xxx or F77xxxC0000000 FFFFFFF8 0000000010110221 12000011 00000040FPU-D Single-precision and Double-precisionAPB1=50000000APB2=100000000800 x 480PLL P:200000000 Q: 50000000 R: 57142857
SDCLK 25000000, 25.00 MHzPLLI2S P: 96000000 Q: 96000000 R: 96000000PLLSAI P: 96000000 Q:192000000 R: 54857142LCDCLK 27428571, 27.43 MHzDSIPLL 500000000, 500.00 MHzlbClk 62500.000 KHzTXEscape 4.001280
2018-03-05 09:50 AM
Yes, it's the same principle as we apply in the computer networking field. Debugging, especially tracing the decision taken on actual data the device processes, is crucial skill. Thanks for your insights. I really appreciate your willingness to share your experience.
2018-03-05 09:53 AM
Clive,
I just tried your code and the VCP works fine.
The display also inits and has text.
But still nothing out of SWO, do you have text continuously transmitted on the VCP and SWO?
I only see text on VCP after reset.
Chris