SWV printf not working in B-L475E-IOT01A (STM32L4 Discovery kit IoT node) board?
Hi, I am trying to get printf functionality work on Discovery kit IoT node board, however it doesn't seem to work.
I went through the user manual and performed the steps mentioned, screenshot from ITM section in user manual is given below,

and below is in the code snippet
//Debug Exception and Monitor Control Register base address
#define DEMCR *((volatile uint32_t*) 0xE000EDFC)
#define DBGMCU_CR *((volatile uint32_t*) 0xE0042004)
/* ITM register addresses */
#define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 )
#define ITM_TRACE_CNTL *((volatile uint32_t*) 0xE0000E80 )
#define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 )
#define ITM_TRACE_PRIVELAGE *((volatile uint32_t*) 0xE0000E40 )
#define ITM_LOCK_ACCESS *((volatile uint32_t*) 0xE0000FB0 )
void ITM_SendChar(uint8_t ch)
{
//Enable TRCENA
DEMCR |= ( 1 << 24);
DBGMCU_CR |= (1 << 0 | 1 << 1 | 1 << 2 | 1 << 5);
DBGMCU_CR &= ~(1 << 6 | 1 << 7);
ITM_LOCK_ACCESS = 0xC5ACCE55;
ITM_TRACE_CNTL = 0x00010005;
//enable stimulus port 0
ITM_TRACE_EN |= ( 1 << 0);
ITM_TRACE_PRIVELAGE |= ( 1 << 0);
// read FIFO status in bit [0]:
while(!(ITM_STIMULUS_PORT0 & 1));
//Write to ITM stimulus port0
ITM_STIMULUS_PORT0 = ch;
}one thing I noticed in debugger is ITM_LOCK_ACCESS register always shows 0 even if I write some value. please let me know if I am doing anything wrong or missing something.
Thanks