cancel
Showing results for 
Search instead for 
Did you mean: 

Debug uart via virtual com port (STM32F769I-DISCO)

ALevc.1
Associate III

Hello,

Somehow I can't get debug uart via virtual port to work. I have followed several youtube videos and and studied user manual for my board that claims that "USART1 is directly available as a virtual COM port of the PC".

The system debug is Serial wire

0693W000000WJlUQAW.png

and usart1 is in async mode

0693W000000WJlfQAG.png

And here is main()

int main(void)
{
  /* USER CODE BEGIN 1 */
	char ch = 'A';
 
  /* 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();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */
 
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
  while (1)
  {
	  HAL_Delay(500);
	  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
	  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

The NVIC global interrupt for USART1 is enabled.

Virtual COM port is present - COM27.

0693W000000WJq5QAG.png

Do I miss something?

Best Regards,

Anton

4 REPLIES 4
TDK
Guru

> Do I miss something?

Did you initialize the correct pins? USART1 is typically available on several pins. Make sure you one you selected matches up with the schematic on the board.

If you feel a post has answered your question, please click "Accept as Solution".
ALevc.1
Associate III

I guess this is the case, the board manual says that usart1_tx is pin PA9 and the CubeIDE assigned it to PB6.

Somehow the IDE doesn't allow to change it into the configuration. Is it possible to use the ide to change the pin?

Found it. It is not in the configuration table it is in the "pin layout" part. It works now. Thanks for the hint!

Most of us here just write the code to do what we want rather the involve the robot.​

The Cube stuff tends to get in its own way and trips over itself​ at every opportunity.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..