Greetings,
I am new to USB, so some help on this would be greatly appreciated.
I am using an STM32F207 chip, and am attempting to get it to come up as a composite USB MSC and CDC device on the FS port under RTX.
I am using the STM3220G-EVAL board to prototype the code with, and am basing it on the sample code provided by keil.
I have successfully built and run the MSC device sample provided for the ST dev board.
I have adapted the MCBSTR750 CDC example to run on the ST dev board (as a simple loop-back). I modified the .inf file provided in that example to match the ST parameters, and the device comes up as a virtual com port just fine.
The problem arises when I attempt to configure the USB libs to run as a composite device. It seems that simply changing the endpoint numbers for one device profile or the other does not work other than to stop the compiler from complaining.
As a simpler test, I built and re-ran the CDC example and changed the interrupt endpoint from 1 to 3, and the bulk in and out endpoints from 2 to 4, uninstalled the CDC device on windows and ran the example again. Win went through the motions of loading the driver and assigning a new com port number, but the example no longer ran.
After each iteration I use device manager (windows xp) to remove the registered device so enumeration can begin anew...is this sufficient, or are there other windows 'things' that need to be cleared or reset?
Is there a trick to selecting endpoint numbers for different USB device types?
I have sample code, I can provide, however it is all just a pared-down version of the code provided by keil...
Thanks in advance for any help you can provide.
> and changed the interrupt endpoint from 1 to 3, and the bulk in and out endpoints from 2 to 4
OTG_FS USB device core on STM32 supports fixed endpoint numbers, just 1, 2, 3, for bulk/interrupt IN/OUT endpoints. There is no EP4.
You may assign endpoints, for example, MSC - bulk IN 1 - bulk OUT1 CDC - interrupt IN2 - bulk IN 3 - bulk OUT3
Tsuneo
Thank-you, Tsuneo.
I have assigned the endpoints as you suggested.
The device enumerates correctly as a composite device, and I get a COM port and drive letter on my computer. No issues reported.
I can read/write the SD card contents without issue.
I can open the COM port using a terminal application, however whenever I type characters in to the terminal, my firmware encounters an OS_ERR_FIFO_OVF error.
The call stack shows me that the overflow is a result of an isr_evt_set call from the OTG_FS_IRQHandler while my USBD_RTX_CDC_EP_BULK_Event task is in a running state.
I have increased my ISR FIFO queue size to max (96 entries) to no avail.
If I uninstall the USB drivers, then build with just the CDC device enabled in the usb_config on endpoints 2 and 3, the device enumerates correctly, however I get the same behaviour on the virtual COM port.
If I uninstall the USB drivers, then build with just the CDC device enabled in the usb_config on endpoints 1 and 2 instead, the serial interface seems to work just fine.
This leads me to believe that it is somehow still related to endpoint selection.
Any ideas on why I may be encountering this? I am using Keil 4.53.
> If I uninstall the USB drivers, then build with just the CDC device enabled in the usb_config on endpoints 2 and 3, the device enumerates correctly, however I get the same behaviour on the virtual COM port. > If I uninstall the USB drivers, then build with just the CDC device enabled in the usb_config on endpoints 1 and 2 instead, the serial interface seems to work just fine.
It leads me to believe that it is definitely related to library implementation. Contact to Keil support.