<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>USB Composite VCOM Speed</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/23648/usb-composite-vcom-speed</link><description> 
Dear all, 
Thanks a lot for every consecutive help i get from this forum and a
special thanks to Tsuneo. 

 
I downloaded VCOM example program from keil but that doesn&amp;#39;t fits
to my requirement. 

 
The code doesn&amp;#39;t work if I transmit the data as soon</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/154024?ContentTypeID=1</link><pubDate>Fri, 16 May 2008 09:31:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:da0b3151-f24b-4401-935c-bbf451e1a6ac</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
I have an appalling experience with usbser.sys. It is by far the
worst driver I ever encounter! I kept on asking myself: &amp;quot;why does
microsoft even support USB if they do not implement the protocol
fully?!&amp;quot;. blue screens on win2k but not on XP (which was not fully
functional either!), program failures, you name it. a total
disaster!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/154565?ContentTypeID=1</link><pubDate>Fri, 16 May 2008 08:33:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:607c5ec5-8ab1-49e5-a67f-60476e8f5421</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Start a new thread, and post your descriptors as code, so they are
readable.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/154041?ContentTypeID=1</link><pubDate>Fri, 16 May 2008 08:30:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6b6abfb0-106c-4b1c-9c66-2e066e60dcdc</guid><dc:creator>Ruben R</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello.&lt;/p&gt;

&lt;p&gt;
First of all, I want to say that I don&amp;#39;t know if this is the right
forum to do the question, but after days searching in the web,
reading papers and changing the code, I&amp;#39;ll try to explain my dude
here.&lt;/p&gt;

&lt;p&gt;
I&amp;#39;m programming a device, with a USB communication in order to
communicate with PC. I use an ATmega1281 with MAX3420 as USB
controller. I get the windows recognize the device as COM Port...but
I can only send or only receive data. If I try to set number of
endpoints to 2 in the Data Class Interface descriptor, windows return
an error (code 10), and can&amp;#39;t initialize the device.&lt;br /&gt;
Here I show the descriptors I use. Thank you for your time in
advance!&lt;/p&gt;

&lt;p&gt;
const unsigned char CD[]=&lt;br /&gt;
// CONFIGURATION Descriptor {0x09, // bLength 0x02, //
bDescriptorType = Config 67,0x00, // wTotalLength(L/H) =
N&amp;Acirc;&amp;ordm; Bytes (67[0x43}) (Sin cabeceras 48[0x30]) 0x4300 0x02,
// bNumInterfaces = 2 0x01, // bConfigValue 0x00, // iConfiguration
0xC0, // bmAttributes. b7=1 b6=NO self-powered b5=RWU supported (1 0
1 0 0 0 0 0) 0x32, // MaxPower is 100 ma&lt;/p&gt;

&lt;p&gt;
// INTERFACE Descriptor 0x09, // length = 9 0x04, // type = IF
0x00, // InterFace Number = 0 0x00, // bAlternate Setting 0x01, //
bNum Endpoints = 1 IN 0x02, // bInterfaceClass = 2 Communication
0x02, // bInterfaceSubClass = 2 0x01, // bInterfaceProtocol =1
(SubClass ACM=Abstract Control Mode, InterfaceProtocol=V.25ter,
common AT commands) 0x00, // iInterface&lt;/p&gt;

&lt;p&gt;
// Header Functional Descriptor (marks beginning of the
concatenated set of Functional Descriptors) 0x05, // bFunctionLength,
Descriptor size in bytes --[18] 0x24, // bDescriptorType,
CS_INTERFACE 0x00, // bDescriptorSubtype, Header Functional
Descriptor 0x10,0x01, // bcdCDC, CDC specification release number in
BCD format (1,1)&lt;/p&gt;

&lt;p&gt;
// Abstract Control Management Functional Descriptor 0x04, //
bDescriptorLength, Descriptor size in bytes 0x24, // bDescriptorType,
CS_INTERFACE 0x02, // bDescriptorSubtype, Abstract Control Management
Functional Descriptor 0x06, // bmCapabilities, Support for the
GET/SET_LINE_CODING, BREAK &amp;amp; SET_CONTROL_LINE_STATE (2-&amp;gt;6)&lt;/p&gt;

&lt;p&gt;
// Union Functional Descriptor 0x05, // bFunctionLength,
Descriptor size in bytes 0x24, // bDescriptorType, CS_INTERFACE 0x06,
// bDescriptorSubtype, Union Functional Descriptor 0x00, //
bMasterInterface, The controlling interface for the union
(bInterfaceNumber of a Communication or Data Class interface in this
configuration) 0x01, // bSlaveInterface0, The controlled interace in
the union (bInterfaceNumber of an interface in this
configuration)&lt;/p&gt;

&lt;p&gt;
// Call Management Functional Descriptor 0x05, // bFunctionLength,
Descriptor size in bytes 0x24, // bDescriptorType, CS_INTERFACE 0x01,
// bDescriptorSubtype, Call Management Functional Descriptor 0x03, //
bmCapabilities, Device doesn&amp;#39;t call management itself (0-&amp;gt;3) 0x01,
// bDataInterface, Interface used for call management&lt;/p&gt;

&lt;p&gt;
// Endpoint Descriptor EP3-IN 0x07, // bLength 0x05, //
bDescriptorType (Endpoint) 0x83, // bEndpointAddress (EP3 IN) 0x03,
// bmAttributes (interrupt = 3) 0x40,0x00, // wMaxPacketSize
(8-&amp;gt;64[0x0040]) 0x02, // bInterval, Maximum latency&lt;/p&gt;

&lt;p&gt;
// INTERFACE Descriptor 0x09, // length = 9 --[44] 0x04, // type =
IF 0x01, // InterFace Number = 1 0x00, // bAlternate Setting 0x02, //
bNum Endpoints = 2 (IN&amp;amp;OUT) 0x0A, // bInterfaceClass = A (Data)
0x00,0x00, // bInterfaceSubClass, bInterfaceProtocol (SubClass
ACM=Abstract Control Mode, InterfaceProtocol=V.25ter, common AT
commands) 0x00, // iInterface&lt;/p&gt;

&lt;p&gt;
// Endpoint Descriptor EP2-IN 0x07, // bLength 0x05, //
bDescriptorType (Endpoint) 0x82, // bEndpointAddress (EP2-IN) 0x02,
// bmAttributes (bulk = 2) 0x40,0x00, // wMaxPacketSize (64[0x40])
0x00, // bInterval&lt;/p&gt;

&lt;p&gt;
// Endpoint Descriptor EP1-OUT 0x07, // bLength 0x05, //
bDescriptorType (Endpoint) 0x01, // bEndpointAddress (EP1-OUT) 0x02,
// bmAttributes (bulk = 2) 0x40,0x00, // wMaxPacketSize (64[0x40])
0x00, // bInterval&lt;br /&gt;
};&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/153430?ContentTypeID=1</link><pubDate>Fri, 09 May 2008 01:25:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f480db2e-1c7a-44c6-9e1d-4be19816d420</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Even i was thinking this..&lt;/p&gt;

&lt;p&gt;
I tested the example in many PCs which doesn&amp;#39;t have usbser.sys
file at all. I was getting problem in all those PCs. In one XP PC
usbser.sys was there but it didn&amp;#39;t worked with that too. I thought of
using windows cdc driver and for that i downloaded usbser.sys. I made
it work with cdc driver too. Just for fun again i tried flashing the
nxp code and this time it started working... Now it is working fine
in the machines where usbser.sys is installed. I don&amp;#39;t know the link
between nxp vendor specific driver and usbser.sys but it worked.&lt;/p&gt;

&lt;p&gt;
Don&amp;#39;t know how....&lt;/p&gt;

&lt;p&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/152743?ContentTypeID=1</link><pubDate>Fri, 09 May 2008 00:52:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1582da40-380a-41f2-81f9-808994ca4d6b</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;All problem was because of a corrupted usbser.sys.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
???&lt;br /&gt;
The NXP example (AN10420) has a vendor specific interfaces, and it
works with the custom device driver attached to the zip file.&lt;/p&gt;

&lt;p&gt;
Windows usbser.sys works with a CDC-ACM device.&lt;br /&gt;
Did you modify the NXP example to a CDC implementation?&lt;/p&gt;

&lt;p&gt;
Anyway, MS starts to distribute Win XP SP3 over Windows
Update.&lt;br /&gt;
&lt;a target="_blank" href="http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3299543&amp;amp;SiteID=17"&gt;forums.microsoft.com/.../ShowPost.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
It has newer versions (usbser.sys: 5.1.2600.5508, usbccgp.sys:
5.1.2600.5512) than the hotfix.&lt;/p&gt;

&lt;p&gt;
This version of usbser.sys and usbccgp.sys allow composite device
of CDC using IAD (Interface Association Descriptor), successfully.
I&amp;#39;m testing it now. Maybe, a composite device with multiple CDC will
also work on this version, which has been proved on Vista SP1.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/148030?ContentTypeID=1</link><pubDate>Fri, 09 May 2008 00:04:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d0ee63d1-cf20-458d-89ee-137aaba77231</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi all,&lt;/p&gt;

&lt;p&gt;
Things started working now. All problem was because of a corrupted
usbser.sys.&lt;/p&gt;

&lt;p&gt;
I downloaded the hotfix freshly from microsoft and everything
started working fine.&lt;/p&gt;

&lt;p&gt;
Thanks a lot to all of you specially Tsuneo.&lt;/p&gt;

&lt;p&gt;
Regard!&lt;br /&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/147397?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 03:04:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cbee1239-a176-481b-9f0b-a0c30f7dd957</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;/p&gt;

&lt;p&gt;
I took the code from 
&lt;a href="http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.lpc214x.usb.zip"&gt;www.standardics.nxp.com/.../code.lpc214x.usb.zip&lt;/a&gt;
and to my surprize, the raw code itself is not working for
reception.&lt;/p&gt;

&lt;p&gt;
I made that NO_UART_CABLE to 1. and when i open the the COM(X) and
type anything there, PC comes to hang. I tried this with many PCs,
same thing happens.&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t think there is any problem in the code. Can you download
usb.zip from the same location and just make a run i you too are
getting the same problem?&lt;/p&gt;

&lt;p&gt;
I want to add one more thing. I am not using MCB2140 board but it
is my custom design similar to MCB2140 and there are no problems with
the board.&lt;/p&gt;

&lt;p&gt;
i will highly appreciate your help&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/147402?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 03:31:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c7eeee5c-7754-401e-9682-94d3576dbf01</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;/p&gt;

&lt;p&gt;
Thats a great help.&lt;/p&gt;

&lt;p&gt;
Right now i am using windows Hyper Terminal program.&lt;/p&gt;

&lt;p&gt;
It would be of great help if you can also guide me for OUT
messges.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/146191?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 02:53:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d67850a6-57f9-420e-9bf7-54c1a691b66f</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;Well, even by doing that the PC comes to hang.&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;quot;I think the PC side USB driver for VCOM is not able to handle the
data and goes to hang.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Test your firmware with a terminal app.&lt;/p&gt;

&lt;p&gt;
RealTerm&lt;br /&gt;
&lt;a href="http://realterm.sourceforge.net/"&gt;realterm.sourceforge.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
DockLight&lt;br /&gt;
&lt;a href="http://www.docklight.de/"&gt;http://www.docklight.de/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
etc.&lt;br /&gt;
&lt;a href="http://wiki.oliverbetz.de/owiki.php/TerminalPrograms"&gt;wiki.oliverbetz.de/.../TerminalPrograms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
If your host app is coded in VB, and it uses OnComm with
RThreshold, you may need to send extra ZLP from the device side. This
problem of IOCTL_SERIAL_WAIT_ON_MASK was seen on usbser.sys on this
topic in USB-IF.&lt;/p&gt;

&lt;p&gt;
&amp;quot;USB CDC USBSER.SYS Buffering delay?&amp;quot;&lt;br /&gt;
&lt;a href="https://www.usb.org/phpbb/viewtopic.php?t=13790"&gt;www.usb.org/.../viewtopic.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
It is also applied to the NXP device driver. In the first place,
the source code for the serial driver on the WinDDK has the problem
on IOCTL_SERIAL_WAIT_ON_MASK handling. Then, any example driver which
follows WinDDK has the same problem.&lt;/p&gt;

&lt;p&gt;
Anyway, the ZLP just after the 64 bytes IN transfer is
&lt;b&gt;required&lt;/b&gt;, regardless of this problem.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/144382?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 01:25:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1e7d2a60-2cde-46de-be17-434d2f4db6f8</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;br /&gt;
Thanks for your great help.&lt;br /&gt;
Well, even by doing that the PC comes to hang.&lt;/p&gt;

&lt;p&gt;
i tried it this way now.&lt;/p&gt;

&lt;pre&gt;
void USB_SOF_Event (DWORD frame)
{
        static int count = 0;
        if(count&amp;gt;=8)
        {
                USB_WriteEP( 0x82, &amp;amp;UART2USBBuf0[0], 64 );
                count = 0;
        }
        else
        count++;
&lt;/pre&gt;

&lt;p&gt;
By this 64 bytes are transmitted in 8 ms.&lt;/p&gt;

&lt;p&gt;
Well, this is max i can get i think. I don&amp;#39;t doubt my firmware
now. I think the PC side USB driver for VCOM is not able to handle
the data and goes to hang. I tried toggling a pin and monitored it in
CRO, the pin gets toggled during USB_WriteEP().&lt;/p&gt;

&lt;p&gt;
I am now going with 64bytes/8msec. But,now I have another set of
problem. My PC shows VCOM8 and VCOM9.&lt;br /&gt;
I have to receive data too. When i try writting something from VCOM8,
the PC gets hang again.&lt;/p&gt;

&lt;p&gt;
This is what i am doing:&lt;/p&gt;

&lt;pre&gt;
void USB_EndPoint2 (DWORD event) {

        BYTE array[64];
  switch (event) {
    case USB_EVT_IN:
          Data2Host0 = 1;
//      if ( ! Data2Host0 )
//      {
//          USB_WriteEP( 0x82, NULL, 0 );        // send ZLP
//          Data2Host0 = 1;
//      }


      break;
        case USB_EVT_OUT:
                IODIR1 |= 1&amp;lt;&amp;lt;16;
                IOPIN1 ^= 1&amp;lt;&amp;lt;16;
                USB_ReadEP(0x02, array);
//        DeviceData2UART( 0 );
          break;
  }
  event;
}

I don&amp;#39;t know what could be the reason


&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/141989?ContentTypeID=1</link><pubDate>Mon, 28 Apr 2008 10:29:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bf0d4d56-bcaa-454f-908d-1527c2189478</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
For the NXP VCOM example also, the principle is the same.&lt;/p&gt;

&lt;p&gt;
You don&amp;#39;t need to modify any descriptor.&lt;/p&gt;

&lt;p&gt;
In the main loop, disable DeviceData2Host( 0 ) call.&lt;br /&gt;
Then, you can use the IN EP2 freely.&lt;/p&gt;

&lt;pre&gt;
demo.c
int main (void) {
  ...
  while (1)           /* Loop forever */
  {
#if USB_VCOM
    if ( &lt;b&gt;/*Data2Host0 ||*/&lt;/b&gt; Data2Host1 ) {
&lt;b&gt;//     DeviceData2Host( 0 );&lt;/b&gt;
       DeviceData2Host( 1 );
    }
    ...
#endif
  }
&lt;/pre&gt;

&lt;p&gt;
Next, enable SOF interrupt as 1ms timer.&lt;/p&gt;

&lt;pre&gt;
usbcfg.h
#define USB_SOF_EVENT       &lt;b&gt;1&lt;/b&gt;
&lt;/pre&gt;

&lt;p&gt;
In the SOF handler, send 64 bytes data on your buffer to the IN
EP2. Also, send ZLP at the first IN EP2 interrupt.&lt;/p&gt;

&lt;pre&gt;
vcomuser.c

/*
 *  USB Start of frame Event Callback
 *    Parameter:       frame: 11-bit Frame Number
 */

#if USB_SOF_EVENT
void USB_SOF_Event (DWORD frame) {
&lt;b&gt;  if ( Data2Host0 ) {
    if ( your_data_is_ready ) {
      //
      // fill your buffer with 64 bytes data here
      //
      USB_WriteEP( USB_ENDPOINT_IN(2), your_buffer_ptr, 64 );  // send 64 bytes data
      Data2Host0 = 0;
    }
  }&lt;/b&gt;
  frame;
}
#endif
...
...
/*
 *  USB Endpoint 2 Event Callback
 *    Parameter:       event
 */

void USB_EndPoint2 (DWORD event) {
  switch (event) {
    case USB_EVT_IN:
&lt;b&gt;      if ( ! Data2Host0 ) {
          USB_WriteEP( USB_ENDPOINT_IN(2), NULL, 0 );        // send ZLP
          Data2Host0 = 1;
      }&lt;/b&gt;
      break;
    case USB_EVT_OUT:
      DeviceData2UART( 0 );
      break;
  }
  event;
}
&lt;/pre&gt;

&lt;p&gt;
This code is supposed to send the data in every 1ms.&lt;br /&gt;
Using the parameter &amp;quot;frame&amp;quot; of USB_SOF_Event(), you can select
arbitrary interval in 1ms step.&lt;/p&gt;

&lt;p&gt;
That&amp;#39;s all.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/138750?ContentTypeID=1</link><pubDate>Mon, 28 Apr 2008 00:22:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:31bc0f6e-49a6-4354-9461-14d244984e2a</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;/p&gt;

&lt;p&gt;
I again reviewed the code and couldn&amp;#39;t trace out the bug. I am
using the PC side driver provided in the same sandbox.&lt;/p&gt;

&lt;p&gt;
I hope you have that VCOM example with you. I have a buffer of
64Bytes with some const datas lets say &amp;quot;aaaa.............1234&amp;quot;; I
have to transfer it at every 1ms or 2ms. Can you suggest me what code
to comment and what to be added where? I have nothing to do with UART
in that code. Board just sends the data. Receiption is event
triggered from same VCOM.&lt;/p&gt;

&lt;p&gt;
Thanks&lt;br /&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/138748?ContentTypeID=1</link><pubDate>Sun, 27 Apr 2008 21:31:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1afb5779-b9f7-49e8-916d-ecc5d4042a51</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes, Its exactly the same.&lt;br /&gt;
I have commented the other USB_WriteEP() functions and in main have
just kept a while(1); And the USB_WriteEP is getting called by
UAB_EndPoint2();&lt;/p&gt;

&lt;p&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/135353?ContentTypeID=1</link><pubDate>Sat, 26 Apr 2008 17:50:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:38fa0b10-96ce-4050-afb3-0be89d17fb07</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I downloaded VCOM example program from keil&amp;quot;&lt;br /&gt;
&amp;quot;I am using VCOM example for MCB2140 board provided by Nxp.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Are you talking about this NXP example?&lt;/p&gt;

&lt;p&gt;
&amp;quot;AN10420: USB Virtual COM Port on LPC214x&amp;quot;&lt;br /&gt;

&lt;a href="http://www.standardics.nxp.com/support/documents/microcontrollers/pdf/an10420.pdf"&gt;www.standardics.nxp.com/.../an10420.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
&amp;quot;Sample Code for AN10420 USB Virtual COM Port on LPC214x&amp;quot;&lt;br /&gt;

&lt;a href="http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.lpc214x.usb.zip"&gt;www.standardics.nxp.com/.../code.lpc214x.usb.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/124617?ContentTypeID=1</link><pubDate>Sat, 26 Apr 2008 03:56:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7bcf14aa-25bf-440b-9fe3-b3d1ed01a93d</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi,&lt;/p&gt;

&lt;p&gt;
I am using VCOM example for MCB2140 board provided by Nxp. I am
calling USB_Write() first in configuration function and then in EP
interrupt functions. I have made no changes in ISR routine. just have
made the time to 8 ms and MaxPacket size to 32. it doesn&amp;#39;t work even
if i make the packet size to 64 or even 16.&lt;/p&gt;

&lt;p&gt;
The PC comes to hang... not able to troubleshoot at all.&lt;/p&gt;

&lt;p&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/113870?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2008 10:29:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a793af84-90da-43a2-a4e8-8def7414617b</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
Are you working on KEIL MCB23xx USBCDC example?&lt;/p&gt;

&lt;p&gt;
If you send just 32 bytes, you don&amp;#39;t need to change any
descriptors.&lt;br /&gt;
The default wMaxPacketSize (= 64) is good for your requirement.&lt;br /&gt;
32 bytes transfer is less than 64. Then, the single packet terminate
the transfer well.&lt;/p&gt;

&lt;p&gt;
You&amp;#39;ve modified the USB EP Interrupt Service Routine (ISR),
USB_EndPoint2().&lt;br /&gt;
But it is a wrong place to modify.&lt;br /&gt;
As VCOM_GetChar() (vcomdemo.c) does, call USB_WriteEP() directly in
the routine in which the data is generated.&lt;/p&gt;

&lt;p&gt;
For IN EP, the EP interrupt is evoked just when the EP buffer
becomes empty. The interrupt is not evoked until you put some data to
the EP buffer, outside of the ISR. Therefore, USB_EndPoint2() is
never called for the IN EP.&lt;/p&gt;

&lt;p&gt;
It is similar to UART TX.&lt;br /&gt;
UART TX interrupt is evoked when the UART TX buffer becomes empty.
The interrupt is not evoked until you put a byte to the UART TX
buffer. Then, you need a kick-off routine to fill the first byte,
even if UART TX is handled using interrupt.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/100564?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2008 06:45:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a495ad02-16cd-45f5-a0dc-8007cfb99ce2</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;br /&gt;
Thanks for the reply and that very useful information. I am getting a
weird problem. Now i have made the max packet size as 32 and IN token
time as 8 ms. I am using two VCOM ports.&lt;/p&gt;

&lt;p&gt;
Have made few changes in the code.&lt;/p&gt;

&lt;pre&gt;
void USB_EndPoint2 (DWORD event) {
  switch (event) {
    case USB_EVT_IN:
        USB_WriteEP(0x82, A_TxData0_U8R, 32);

&lt;/pre&gt;

&lt;p&gt;
In usbDesc.c i have changed the time to 8 ms, USB_MAX_PACKET0 as
34,&lt;br /&gt;
WBVAL(0x20),/* wMaxPacketSize */.&lt;/p&gt;

&lt;p&gt;
My firmware always transfers an array A_TxData0_U8R of size 32
byte.&lt;/p&gt;

&lt;p&gt;
Even with this simple code the PC comes to hang.&lt;br /&gt;
I am not able to troubleshoot it.&lt;/p&gt;

&lt;p&gt;
It would be even fine if I can transfer 32Bytes in 1 ms from 1
VCOM port.&lt;/p&gt;

&lt;p&gt;
Another interesting thing is if I set a flag in the void
USB_EndPoint2 (DWORD event) function, check that in main(), and
transfer the data after 4 ms, it works. But according to my design
constrains i cannot go with this implementation.&lt;/p&gt;

&lt;p&gt;
Please guide me how i can overcome this problem. If you can give
some coding help also, it would be very great.&lt;/p&gt;

&lt;p&gt;
Thanks!&lt;br /&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/102903?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2008 06:45:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0df2b1de-552a-4936-a526-fc16e2ec086c</guid><dc:creator>Kamal Kant Joshi</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo,&lt;br /&gt;
Thanks for the reply and that very useful information. I am getting a
weird problem. Now i have made the max packet size as 32 and IN token
time as 8 ms. I am using two VCOM ports.&lt;/p&gt;

&lt;p&gt;
Have made few changes in the code.&lt;/p&gt;

&lt;pre&gt;
void USB_EndPoint2 (DWORD event) {
  switch (event) {
    case USB_EVT_IN:
        USB_WriteEP(0x82, A_TxData0_U8R, 32);

&lt;/pre&gt;

&lt;p&gt;
In usbDesc.c i have changed the time to 8 ms, USB_MAX_PACKET0 as
34,&lt;br /&gt;
WBVAL(0x20),/* wMaxPacketSize */.&lt;/p&gt;

&lt;p&gt;
My firmware always transfers an array A_TxData0_U8R of size 32
byte.&lt;/p&gt;

&lt;p&gt;
Even with this simple code the PC comes to hang.&lt;br /&gt;
I am not able to troubleshoot it.&lt;/p&gt;

&lt;p&gt;
It would be even fine if I can transfer 32Bytes in 1 ms from 1
VCOM port.&lt;/p&gt;

&lt;p&gt;
Another interesting thing is if I set a flag in the void
USB_EndPoint2 (DWORD event) function, check that in main(), and
transfer the data after 4 ms, it works. But according to my design
constrains i cannot go with this implementation.&lt;/p&gt;

&lt;p&gt;
Please guide me how i can overcome this problem. If you can give
some coding help also, it would be very great.&lt;/p&gt;

&lt;p&gt;
Thanks!&lt;br /&gt;
Kamal&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/76220?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2008 06:25:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:66e268f2-2ac9-4346-94d3-634e31300a04</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;ve seen this kind of question related to &amp;quot;transfer&amp;quot; many
times.&lt;br /&gt;
The understanding of &amp;quot;transfer&amp;quot; and its termination is the first
hurdle in USB study.&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;1) Transfer&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
&amp;quot;Transfer&amp;quot; is the greatest unit of communication sequence on
USB.&lt;br /&gt;
USB carries transfer splitting into packets(*) on the bus. The
wMaxPacketSize field of the endpoint descriptor determines the size
of division unit.&lt;/p&gt;

&lt;p&gt;
Host app handles transfer directly, and firmware does in the split
shape, a sequence of packets.&lt;/p&gt;

&lt;p&gt;
For example, suppose that a host app sends 200 bytes of data. It
is sent by single WriteFile (or equivalent call) to the device
driver. The device driver and the host controller splits it into
packets, according to the wMaxPacketSize of the endpoint. When
wMaxPacketSize = 64, the firmware sees this sequence of packets.&lt;/p&gt;

&lt;p&gt;
64 + 64 + 64 + 8&lt;/p&gt;

&lt;p&gt;
In the opposite direction, also, the reverse process is done; the
firmware sends a sequence of packets, they are combined together into
a single block, and handed to the host app as a single transfer.&lt;/p&gt;

&lt;p&gt;
In this way, any size of transfer is carried over USB, even if it
grows up to MBytes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;2) Termination of transfer&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
USB spec defines the end of bulk and interrupt transfer as
follows,&lt;/p&gt;

&lt;pre&gt;
a) Has transferred exactly the amount of data expected
b) Transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet

5.8.3 Bulk Transfer Packet Size Constraints (usb_20.pdf p53)
5.7.3 Interrupt Transfer Packet Size Constraints (usb_20.pdf p49)
&lt;/pre&gt;

&lt;p&gt;
a) Expected transfer size&lt;br /&gt;
The host side always knows the expected transfer size, because any
transfer is initiated by the host, regardless of the transfer
direction, IN or OUT.&lt;/p&gt;

&lt;p&gt;
For example, these parameters of ReadFile and WriteFile mean the
expected transfer size.&lt;br /&gt;
ReadFile( ..., nNumberOfBytesToRead, ...)&lt;br /&gt;
WriteFile(..., nNumberOfBytesToWrite, ...)&lt;/p&gt;

&lt;p&gt;
On the other hand, the firmware doesn&amp;#39;t know the expected
size,&lt;br /&gt;
unless the host sends it to the firmware beforehand,&lt;br /&gt;
OR, it is documented explicitly as the protocol design.&lt;/p&gt;

&lt;p&gt;
b) Short packet&lt;br /&gt;
Short packets means a packet shorter than wMaxPacketSize, including
ZLP.&lt;br /&gt;
As above example shows, each packet on a transfer has wMaxPacketSize
of data, until the last one. A short packet appears at the end of
transfer.&lt;/p&gt;

&lt;p&gt;
When the transfer size is just the multiple of wMaxPacketSize, ZLP
is appended to the transfer &lt;b&gt;to stop the transfer in halfway&lt;/b&gt;,
before the transfer size reaches to the expected size.&lt;/p&gt;

&lt;p&gt;
For example, the host app requests 200 bytes transfer,&lt;br /&gt;
nNumberOfBytesToRead = 200;&lt;br /&gt;
ReadFile( ..., nNumberOfBytesToRead, ...);&lt;/p&gt;

&lt;p&gt;
And the firmware returns 128 bytes (wMaxPacketSize = 64),&lt;br /&gt;
64 + 64 + 0(ZLP)&lt;/p&gt;

&lt;p&gt;
ZLP is appended because the firmware cuts off the transfer.&lt;/p&gt;

&lt;p&gt;
However, the host app requests just 128 bytes here, no ZLP is
required, because it matches to the expected size.&lt;/p&gt;

&lt;p&gt;
nNumberOfBytesToRead = 128;&lt;br /&gt;
ReadFile( ..., nNumberOfBytesToRead, ...);&lt;br /&gt;
64 + 64 (no ZLP)&lt;/p&gt;

&lt;p&gt;
Please note, ZLP is seen just for IN transfers, not for OUT
transfers, because host always sends just the expected size of OUT
transfers. No way to stop it without error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;3) The CDC device driver&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
A generic device driver is supposed in above examples.&lt;br /&gt;
However, the CDC device driver issues bulk IN transfer by itself.
ReadFile doesn&amp;#39;t directly link to the USB transfer any more. ReadFile
just reads the data on the RX buffer on the device driver.&lt;/p&gt;

&lt;p&gt;
The expected size for the bulk IN transfer is not clear (maybe it
depends on Windows version), MS haven&amp;#39;t documented anywhere. But It
seems greater than 4 Kbytes.&lt;br /&gt;
Then, always put ZLP, whenever the transfer size is just the multiple
of 64 bytes on the firmware.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;
This is the full story of transfer and ZLP.&lt;br /&gt;
Complicated?&lt;br /&gt;
That is why it is called as the first hurdle of USB :-)&lt;/p&gt;

&lt;p&gt;
(*)For simplicity, I dare to use the term &amp;quot;packet&amp;quot; incorrectly in
USB sense here. More precisely, it is called as the payload of the
DATA packet on an IN/OUT transaction.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Composite VCOM Speed</title><link>https://community.arm.com/thread/49779?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2008 02:35:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:63d508a9-da9d-43dd-aea8-0178cad8063e</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I want to transmit 64bytes in 1 ms.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Put ZLP (Zero-Length Packet) to the bulk IN EP, as the next packet
just after the 64 bytes.&lt;/p&gt;

&lt;p&gt;
64 bytes is a critical number for the bulk IN EP on Full speed,
because it matches just to the wMaxPacketSize of the EP. While the
firmware puts 64 bytes, the transfer continues. The host controller
on the PC holds the packets and it doesn&amp;#39;t hand the packets to the
device driver, until it sees a short packet (including ZLP). Then,
your host app hangs, dried up by no input.&lt;/p&gt;

&lt;p&gt;
To put a ZLP to the IN EP, USB_WriteEP( the_EP, NULL, 0 );&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>