2022-06-22 12:24 AM
2022-06-23 04:56 PM
2022-06-23 02:14 AM
Hi,
which IDE do you use? Keil, IAR or STM32CubeIDE?
Rgds
BT
2022-06-23 05:22 AM
Hello,
I use STM32CubeIDE V1.9.0
I do the same operations on the Nucleo-STM32L552 and it work correctly.
But impossible on the Nucleo-STM32U575.
Thank you
2022-06-23 08:36 AM
Hi,
I would suggest to check the following points:
Hope this helps
Rgds
BT
2022-06-23 09:22 AM
Hello Brian,
Many thanks for your speed answer.
I check, point by point all your recommendations, and everything is ok.
But it don't work.
If i put a breakpoint in my _write function, it never stop here
int _write(int file, char *ptr, int len) // printf function
{int i;
for(i=0; i<len; i++)
ITM_SendChar((*ptr++));
return(len);
}
Maybe it would be easier to understand if I send you the project ?
Thank you
2022-06-23 09:44 AM
Hi Elio,
if the breakpoint in _write is not hit, this means that the problem is probably not inside the ITM.
Anyway, let's first make sure the ITM is properly functional: can you add the following line in your main after the HAL_Init and SystemClock_Config (typically in user code begin 2 if you have generated from STM32CubeMX):
ITM_SendChar('O');
ITM_SendChar('K');
ITM_SendChar('\r');
ITM_SendChar('\n');
Can you confirm you see the "OK" on the SWV ITM Data Console?
If it is OK, can you confirm that you have a syscall.c file in your project? can you confirm that the following function is inside this file: __attribute__((weak)) int _write(int file, char *ptr, int len)?
Can you set a breakpoint in this function and is the breakpoint hit during printf?
Can you also check that your program has not fallen into an exception and is not stuck in the hard fault handler loop?
Rgds
BT
2022-06-23 10:04 AM
+1
Definitely check the ITM_SendChar() outside of the plumbing for the STDIO
I'll check the NUCLEO-U575ZI this evening
2022-06-23 10:26 AM
Hello,
Thank you very much for your help.
I put after the user code begin 2 those code lignes
ITM_SendChar('O');
ITM_SendChar('K');
ITM_SendChar('\r');
ITM_SendChar('\n');
And the "OK" don't appear on the SWV ITM Data Console.
Thank you
2022-06-23 11:16 AM
Hi,
can you confirm that your program reach the ITM_SendChar lines i.e. can you confirm that your program is no stuck before due to some error? Can you check that the SystemClock_Config returns properly?
Rgds
BT
2022-06-23 12:44 PM
Hello again Brian,
I go in all the lignes of the ITM_SendChar program :
__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
{
if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
{ while (ITM->PORT[0U].u32 == 0UL)
{ __NOP();
}
ITM->PORT[0U].u8 = (uint8_t)ch;
}
return (ch);
}
And i verify that SystemClock_Config returns properly, there is no error.
My program is no stuck.
Thank you for your help.