Printf in Atollic still doesn't work correctly
Hi,
I am using the Nucleo-H743ZI, when trying to printf a buffer I see lots of data missing. Even when just trying to printf a counter I see the same issue, I tried it in Atollic as well as ST_LINK and I get same issue.
I saw many issues in the past and was able to find a solution to print something here:
https://community.st.com/s/question/0D50X00009XkhURSAZ/stm32h7-swo-printf-not-working
But still this causing the issue above.
I am using the code below in order to enable the ITM.
void ITM_enable(void)
{
*(__IO uint32_t*)(0x5C001004) = 0x00700000;
//UNLOCK FUNNEL
*(__IO uint32_t*)(0x5C004FB0) = 0xC5ACCE55;
*(__IO uint32_t*)(0x5C003FB0) = 0xC5ACCE55;
//SWO current output divisor register
//This divisor value (0x000000C7) corresponds to 400Mhz
//To change it, you can use the following rule
// value = (CPU Freq/sw speed )-1
*(__IO uint32_t*)(0x5C003010) = (*(__IO uint32_t*)(0x5C003010) & 0xfffff000) | 0x000000C7;
//SWO selected pin protocol register
*(__IO uint32_t*)(0x5C0030F0) = 0x00000002;
//Enable ITM input of SWO trace funnel
*(__IO uint32_t*)(0x5C004000) = *(__IO uint32_t*)(0x5C004000) | 0x00000001;
//RCC_AHB4ENR enable GPIOB clock
*(__IO uint32_t*)(0x580244E0) = *(__IO uint32_t*)(0x580244E0) | 0x00000002;
// Configure GPIOB pin 3 as AF
*(__IO uint32_t*)(0x58020400) = (*(__IO uint32_t*)(0x58020400) & 0xffffff3f) | 0x00000080;
// Configure GPIOB pin 3 Speed
*(__IO uint32_t*)(0x58020408) = *(__IO uint32_t*)(0x58020408) | 0x00000080;
// Force AF0 for GPIOB pin 3
*(__IO uint32_t*)(0x58020420) = *(__IO uint32_t*)(0x58020420) & 0xFFFF0FFF;
}
Thanks
Sharon