Skip to main content
arduo
Associate III
January 15, 2019
Solved

Forward Data from VCP to UART

  • January 15, 2019
  • 7 replies
  • 1362 views

How can i forward data which i received at my COM Port via USB FS to a UART of my Choice?

I already send data to UART5 and i measured it with an osci and its working

har buffer[] = "TEST";
HAL_UART_Transmit(&huart5, buffer, sizeof(buffer), HAL_MAX_DELAY);

So How can i forward data from VCP received in a Terminal to any UART?

This topic has been closed for replies.
Best answer by Tesla DeLorean

Probably use a buffer/fifo and NOT use blocking functions?

7 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
January 15, 2019

Probably use a buffer/fifo and NOT use blocking functions?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
arduo
arduoAuthor
Associate III
January 16, 2019
	char byte[2000];
	for (;;)
	{
		if (VCP_read(&byte, 1) != 1)
			continue;
		
	
		HAL_UART_Transmit(&s_UARTHandle, byte, sizeof(byte), HAL_MAX_DELAY);
		VCP_write("\r\nYou typed ", 12);
		VCP_write(&byte, 1);
		VCP_write("\r\n", 2);
		
	}

i did this and it worked i get data out of the uart when i type something through the terminal how can i do it with buffer/fifo any tutorials or websites?

waclawek.jan
Super User
January 15, 2019

Review the examples in Cube, e.g. [CubeF4]\Projects\STM324xG_EVAL\Applications\USB_Device\CDC_Standalone\

JW

arduo
arduoAuthor
Associate III
January 15, 2019

where can i find them ?

Tomas DRESLER
Associate II
January 15, 2019

Start CubeMx and look in the Help | Updater settings. First item is Repository folder, so follow it and you'll find all MCUs installed with their HAL packages. Start looking there!

Btw. it contains so many examples I bookmarked it in my Explorer library.