<?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 CDC WorngPID error</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/26003/usb-cdc-worngpid-error</link><description> 
Hi there! i&amp;#39;ve googling for a few days to find out what&amp;#39;s wrong
with my cdc implementation. Finally i found this forum with many
threads about usb cdc. 

 
I&amp;#39;m trying to connect my atmega3xx to my nokia s60 os through
Max3421E. Nokia has a cdc class</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: USB CDC WorngPID error</title><link>https://community.arm.com/thread/104271?ContentTypeID=1</link><pubDate>Sun, 26 Sep 2010 19:21:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d464f0c-349b-4c0f-8ab4-2457ed3246d8</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;gt; sniff usb packets with snoopPro&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Is it done over a USB1.1 hub?&lt;br /&gt;
When the phone is connected to a PC USB port directly, or over a
USB2.0 hub, the phone exposes high-speed configuration. But when it
is connected to MAX3421E, full-speed configuration appears. There is
no guarantee that both configurations assign the same endpoints to
the CDC interfaces.&lt;br /&gt;
USB1.1 hub forces the bus speed to full speed. And then, you can see
the full-speed configuration of the device on your PC.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;gt; Do i need to Send a Set_CodingLine according with what
speed??&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I&amp;#39;m not sure.&lt;br /&gt;
Following the CDC-ACM spec strictly, Set_Line_Coding request doesn&amp;#39;t
affect USB side at all. It sets up UART on the device, if any. But
there are so many variation on the device implementations. Some
device implementation may assign additional function to the request,
apart from the original spec.&lt;/p&gt;

&lt;p&gt;
It&amp;#39;s better to examine the minimum requirement of the USB request
on your PC.&lt;br /&gt;
Make a simple PC application using Win32 serial API, which can
communicate with the phone.&lt;br /&gt;
And boil it down into minimum one.&lt;br /&gt;
For example,&lt;/p&gt;

&lt;pre&gt;

                                     // open the COM port - no request on the USB side
    HANDLE hCOM = CreateFile(&amp;quot;\\\\.\\COM7&amp;quot;, GENERIC_READ | GENERIC_WRITE, 0, 0,
                             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

                                    // set baudrate, parity, etc.
                                    // SetCommState() generates Get_Line_Coding, Set_Line_Coding
                                    // and Set_Control_Line_State requests
    DCB dcb;
    dcb.BaudRate = 115200;
    dcb.Parity   = NOPARITY;
    dcb.ByteSize = 8;
    dcb.StopBits = ONESTOPBIT;
    BOOL result = SetCommState( hCOM, &amp;amp;dcb );

                                    // assert DTR
                                    // EscapeCommFunction() puts Set_Control_Line_State
    EscapeCommFunction( hCOM, SETDTR );

                                    // send data to the device
                                    // WriteFile() generates bulk OUT transfer
    BYTE sampleData[16] = { 0x01, 0x02, ... };
    DWORD bytesWritten;
    WriteFile( hCOM, sampleData, 16, &amp;amp;bytesWritten, NULL );

                                    // read data from the device
                                    // ReadFile() puts no USB request, it reads RX buffer on the device driver
                                    // PC device driver repeats bulk IN transfer, separately, to fill the RX buffer
    DWORD bytesRead;
    ReadFile( hCOM, sampleData, 16, &amp;amp;bytesRead, NULL);

                                    // de-assert DTR
                                    // EscapeCommFunction() puts Set_Control_Line_State
    EscapeCommFunction( hCOM, CLRDTR );

                                    // CloseHandle() puts Set_Control_Line_State
    CloseHandle( hCOM );
&lt;/pre&gt;

&lt;p&gt;
Does it still work without SetCommState() and/or
EscapeCommFunction() ?&lt;br /&gt;
When you get the minimum one, trace the USB request sequence on a
sniffer&lt;br /&gt;
And implement the sequence to MAX3421E&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 CDC WorngPID error</title><link>https://community.arm.com/thread/78678?ContentTypeID=1</link><pubDate>Sun, 26 Sep 2010 16:47:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:57e08280-4dee-4b2a-932c-fd575699e649</guid><dc:creator>Nuno Fialho</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you so much for your time!!&lt;/p&gt;

&lt;p&gt;
I already do that, sniff usb packets with snoopPro and when i
order the phone to send &amp;quot;hello World&amp;quot;, i get it from BulK-IN endpoint
address 0x8c, which is this i&amp;#39;m sending for, requesting the data. i
also get the device descriptor.&lt;/p&gt;

&lt;p&gt;
I think i&amp;#39;m so close, because i see a kind of communication when a
i send &amp;quot;hello world&amp;quot; from phone and MAX3421E change his behavior
changing the error returned to atmega.&lt;/p&gt;

&lt;p&gt;
I believe this error is somehow related with diferent speed
settings which is corrupting the packet PID, but i don&amp;acute;t know
how to debug this error.&lt;/p&gt;

&lt;p&gt;
Best Regards&lt;/p&gt;

&lt;p&gt;
Nuno Fialho&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC WorngPID error</title><link>https://community.arm.com/thread/58692?ContentTypeID=1</link><pubDate>Sun, 26 Sep 2010 15:18:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:770327da-8e87-470a-acdf-f5e2e75772b3</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
Are you really hitting the CDC-ACM bulk IN/OUT endpoints of the
cellphone?&lt;br /&gt;
Some Nokia cellphones expose composite device over USB.&lt;br /&gt;
Also, it may change configuration on full-speed bus from high-speed
bus.&lt;/p&gt;

&lt;p&gt;
Read out Device and Configuration descriptor set from the
cellphone over MAX3421E&lt;/p&gt;

&lt;p&gt;
OR&lt;/p&gt;

&lt;p&gt;
Read out the descriptors on a PC over a &lt;b&gt;legacy (USB1.1)
hub&lt;/b&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></channel></rss>