cancel
Showing results for 
Search instead for 
Did you mean: 

SWD and ITM - weird caracters, fail to enable SWD configuration and execute MI command

Dihya
Associate

Good morning,

I want to use the SWD and ITM to print traces.

I followed the instructions of the STM32CubeIDE user manual but I got this error :

Capture d'écran 2024-06-12 115210.png

And I have this printed in the SWD Data Console :

Capture d'écran 2024-06-14 104309.png

I tried the solutions of the other topics related (even uninstalled stm32CubeIDE) but i've had the same issue.

My main is the following :

int main(void)

{

 

/* USER CODE BEGIN 1 */

int _write(int file, char *ptr, int len)

{

int DataIdx;

for (DataIdx = 0; DataIdx < len; DataIdx++)

{

//__io_putchar(*ptr++);

ITM_SendChar(*ptr++);

}

return len;

}

 

/* USER CODE END 1 */

 

/* MCU Configuration--------------------------------------------------------*/

 

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_Init();

 

/* USER CODE BEGIN Init */

 

/* USER CODE END Init */

 

/* Configure the system clock */

SystemClock_Config();

 

/* Configure the peripherals common clocks */

PeriphCommonClock_Config();

 

/* USER CODE BEGIN SysInit */

 

/* USER CODE END SysInit */

 

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_DMA_Init();

MX_ADC1_Init();

MX_CRC_Init();

MX_I2C1_Init();

MX_I2C3_SMBUS_Init();

MX_IWDG_Init();

MX_LPTIM1_Init();

MX_LPTIM2_Init();

MX_LPUART1_UART_Init();

MX_USART1_UART_Init();

MX_QUADSPI_Init();

MX_RTC_Init();

MX_SPI1_Init();

MX_SPI2_Init();

MX_TIM1_Init();

MX_TIM2_Init();

MX_TIM16_Init();

MX_TIM17_Init();

MX_USB_PCD_Init();

MX_WWDG_Init();

MX_RF_Init();

/* USER CODE BEGIN 2 */

 

/* USER CODE END 2 */

 

/* Infinite loop */

/* USER CODE BEGIN WHILE */

char* message = "hello";

 

while (1)

{

printf("%s", message); // Utilisation de printf pour envoyer le message

// ...

}

/* USER CODE END 3 */

}

 

thank you for any help you can provide

1 REPLY 1
Dihya
Associate

Hello,

I try to put the write function outside my main but I still have the same issue, I also try to put the debug in "Serial Wire" and then in "Asynchronous trace" in the .ioc but the error is still here...
Does someone have an idea ?

 

Thank you