2020-04-23 02:42 AM
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
and usart1 is in async mode
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.
Do I miss something?
Best Regards,
Anton
2020-04-23 06:28 AM
> 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.
2020-04-24 01:13 AM
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?
2020-04-24 01:23 AM
Found it. It is not in the configuration table it is in the "pin layout" part. It works now. Thanks for the hint!
2020-04-24 01:24 AM
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.