2020-09-22 10:15 AM
I am using nucleo-H473ZI2 with CubeIDE. When I was trying to print a 1024-long int array, the SWV ITM Data Console will not be giving me all 1024 values.
I implement printf to ITM Stimulus port by writing this function in main.c:
int _write(int file, char *ptr, int len)
{
/* Implement your write code here, this is used by puts and printf for example */
int i=0;
for(i=0 ; i<len ; i++)
ITM_SendChar((*ptr++));
return len;
}
Then I am trying to print out all values in the array:
int print_array[1024];
for(int i=0; i<1024; i++){
print_array[i] = i;
}
printf("Hello World!\n");
//Print out array values
for(int i=0; i<1024; i++){
printf("%d, \n", i);
HAL_Delay(5);
}
HAL_Delay(1000);
//Print some more to make sure all data is finished printing
for(int i=0; i<2; i++){
printf("Hello World\n");
HAL_Delay(5);
}
HAL_Delay(100);
while(1);
But the result I get in the SWV ITM Data Console will only be consisting around 900 numbers instead of 1024 numbers. And the amount of number is fluctuating as well.
I am wondering why this happened, and whether there is any way to avoid it?
Thank you very much!
2020-09-22 10:33 AM
2020-09-22 10:36 AM
Thank you very much, at least I know I am not the only one.
JZ
2020-09-22 12:29 PM
Not really designed/prioritized for high bandwidth output. Buffering on the ST-LINK is finite.
Try buffering on the STM32 side, and using the VCP
Try something more industrial https://www.segger.com/products/debug-probes/j-link/models/j-link-ultra-plus/
2020-09-22 04:10 PM
2020-09-23 07:33 AM
An alternative for high speed / high volume SWO (I use 12 Mbit/s on F429):