cancel
Showing results for 
Search instead for 
Did you mean: 

Forward Data from VCP to UART

arduo
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

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

View solution in original post

7 REPLIES 7

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

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

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

JW

where can i find them ?

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.

There is no example for my issue for VCP forwarding data to uart

	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?

What's wrong with the example I pointed out above?

JW