USB CDC Host demo (FS or HS) STM32F7 Discovery
Well, i had found an example for an USB-CDC HAL based upon STm32F746 Disco board. This project is more complex, but i assume that you know how the USB-Support routines needs to be handled.
you need to download the “STM32_USB_Device_Library” sources and enable the HAL support for the USB.
Both are available by CubeMX and could be preconfigured for just a test. The attached File SRC.ZIP are the main fsource files that requires the both source codes from st. It uses the HS-USB port of the STM32F7 Disco board.
I assume this could be used on the other F7 Nucleos too, but i had not done them as now.
The packed source files are snipps - this is not an entire project. This shoudl explain how the interface needs to be handled.
If everythings is working fine, a COM device must be available in teh device manager of Windows 10, without installing a driver. The speed setting of the PC program, who open the virtual serial port, is unimportant - i usualy uses 115KBit/s.
I had added some comments in german to explain the functionality. Well, just use goolge xlator.
Generaly, you need to declare a routines for HS or FS USB. You need to have an ringbuffer for incomming and outgoing characters. The USB port handles the port by using an IRQ and their ISR.
The routes working proper in a freeRTOS environment too.
MX_USB_DEVICE_Init(); // init USB CDC Device 0)
{
sprintf (cp, “Got frame of length %d: %s “, len, buf);
GUI_DispStringAt (cp, 0, 230); // empfangene Zeichenkette ausgeben
}
}
osDelay(10);
}
}
.................................
And this is a sender call from STM to the PC - not magic
Len = strlen(uhrzeit);
CDC_Transmit_FS ( (uint8_t *) uhrzeit, Len); //! USB2.0 480Mbit
I hope this will helps you to solve your issues.