EmbeddedRelated.com
Forums

Usb cdc class

Started by leomecma September 14, 2012
Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP and the comunication is very slow not baudrate, but the accept new packets. Has anyone experience this problem?

Leo

An Engineer's Guide to the LPC2100 Series

I have had the same problem, it was a long while back, when sending a big amount of data from the controller to pc I would lose data.
It was because the example code didn't handle usb-stalled very well.
I dont know if the problem also occurs in pc to controller transfers.

--
Kevin
--- In l..., "leomecma" wrote:
>
> Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP and the comunication is very slow not baudrate, but the accept new packets. Has anyone experience this problem?
>
> Leo
>

Hello Kevin,

correct me if i am wrong, but "usb-stalled" is not happening
in normal situations (even with high traffic),
but a consequence of a previous (different) error?

Were you able to solve the problem?
Can perhaps share the changes?

Best regards,

Martin

--- In l..., "k_erkens" wrote:
>
> I have had the same problem, it was a long while back, when sending a big amount of data from the controller to pc I would lose data.
> It was because the example code didn't handle usb-stalled very well.
> I dont know if the problem also occurs in pc to controller transfers.
>
> --
> Kevin
> --- In l..., "leomecma" wrote:
> >
> > Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP and the comunication is very slow not baudrate, but the accept new packets. Has anyone experience this problem?
> >
> > Leo
>

It was some time ago, so i don't remember all the details. And i also had to port the example from IAR to GCC. And I used the LPC2468, in combination with FreeRTOS.
Stalled may not be the correct term, however a data transfer can be "paused".
In the end I did get it working, but I don't have the code here with me.
On Monday I will try and get the changes I made, unfortunately I have touched and changed a lot of the original code to get it to run in my setup. Therefore a simple diff wont work.

--
Kevin
--- In l..., "capiman26061973" wrote:
>
> Hello Kevin,
>
> correct me if i am wrong, but "usb-stalled" is not happening
> in normal situations (even with high traffic),
> but a consequence of a previous (different) error?
>
> Were you able to solve the problem?
> Can perhaps share the changes?
>
> Best regards,
>
> Martin
>
> --- In l..., "k_erkens" wrote:
> >
> > I have had the same problem, it was a long while back, when sending a big amount of data from the controller to pc I would lose data.
> > It was because the example code didn't handle usb-stalled very well.
> > I dont know if the problem also occurs in pc to controller transfers.
> >
> > --
> > Kevin
> >
> >
> > --- In l..., "leomecma" wrote:
> > >
> > > Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP and the comunication is very slow not baudrate, but the accept new packets. Has anyone experience this problem?
> > >
> > > Leo
> > >
>

Hello Leo,

> Anyone has used LPC2366 usb as cdc class?
> I am using the sample from NXP and the comunication
> is very slow not baudrate, but the accept new packets.
> Has anyone experience this problem?

can you write a bit more in detail, what (software) parts
you are using? Do you use some version (which?) of
nxpusblib or some other USB software published by NXP?

Which driver are you using on PC side? I assume you are using
a Windows OS (which?). Are you using just a INF file
or a INF / sys driver published by NXP?

Could it have something to do with ZLP (zero length packets)?
Which side is slow? When the device is sending something
to the PC or the other side, when PC is sending something
to the device? What do you mean by "slow"?

Best regards,

Martin

I'm using windows. I send data from PC to board and from board to PC. The software came with IAR workbench (I will check the exactly version on Monday). The driver on PC side is provide by IAR/NXP too. Both sides is slow. For some reason, when I send packets there's a delay between they at least 50ms (and USB packets are maximum of 64 bytes in the code), I don't know where this 50ms appears. To transfer only 100KB is about 3 minutes. On PC side I'm using C++ Builder. I have tried change the compiler and language (Visual Studio and C#) but remains slow, then I think that problem is in board code. I let only the USB running in my board.

Leo

--- In l..., "capiman26061973" wrote:
>
> Hello Leo,
>
> > Anyone has used LPC2366 usb as cdc class?
> > I am using the sample from NXP and the comunication
> > is very slow not baudrate, but the accept new packets.
> > Has anyone experience this problem?
>
> can you write a bit more in detail, what (software) parts
> you are using? Do you use some version (which?) of
> nxpusblib or some other USB software published by NXP?
>
> Which driver are you using on PC side? I assume you are using
> a Windows OS (which?). Are you using just a INF file
> or a INF / sys driver published by NXP?
>
> Could it have something to do with ZLP (zero length packets)?
> Which side is slow? When the device is sending something
> to the PC or the other side, when PC is sending something
> to the device? What do you mean by "slow"?
>
> Best regards,
>
> Martin
>

--- In l..., "leomecma" wrote:
>
> Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP and the comunication is very slow not baudrate, but the accept new packets. Has anyone experience this problem?
>
> Leo
>

I use LPC2366 with USB cdc class but use LPCUSB... I don't know if the NXP library is another implementation or LPCUSB that has been modified.

I also don't think that I have checked the transfer rate or if the transfers stop and start a lot.

Maybe I should check somehow and see if it does the same thing you are seeing ?? How are you measuring this data rate ? Are you sending some large block of data and just timing how long it takes to send the whole thing or are you profiling all of the transfers and starts and stops of blocks ??

boB

FYI: I built a project using Keil's USB CDC on a LPC2388. Couldn't get
greater transfer speed than 120 kiloBytes/s.

2012/9/15 boB G

> **
> --- In l..., "leomecma" wrote:
> >
> > Anyone has used LPC2366 usb as cdc class? I am using the sample from NXP
> and the comunication is very slow not baudrate, but the accept new packets.
> Has anyone experience this problem?
> >
> > Leo
> > I use LPC2366 with USB cdc class but use LPCUSB... I don't know if the NXP
> library is another implementation or LPCUSB that has been modified.
>
> I also don't think that I have checked the transfer rate or if the
> transfers stop and start a lot.
>
> Maybe I should check somehow and see if it does the same thing you are
> seeing ?? How are you measuring this data rate ? Are you sending some large
> block of data and just timing how long it takes to send the whole thing or
> are you profiling all of the transfers and starts and stops of blocks ??
>
> boB
>
>
>


What you describe is different from the problem I had, mine was fast but lost some data.

Have you tried an usb-analyzer (I used a hardware one). If you see the actual communication it might help to understand why it is so slow.

Have you also tried a normal serial-port terminal program, because I also discovered that the terminal program can also slow down the communication.

--
Kevin
--- In l..., "leomecma" wrote:
>
> I'm using windows. I send data from PC to board and from board to PC. The software came with IAR workbench (I will check the exactly version on Monday). The driver on PC side is provide by IAR/NXP too. Both sides is slow. For some reason, when I send packets there's a delay between they at least 50ms (and USB packets are maximum of 64 bytes in the code), I don't know where this 50ms appears. To transfer only 100KB is about 3 minutes. On PC side I'm using C++ Builder. I have tried change the compiler and language (Visual Studio and C#) but remains slow, then I think that problem is in board code. I let only the USB running in my board.
>
> Leo
>
> --- In l..., "capiman26061973" wrote:
> >
> >
> >
> > Hello Leo,
> >
> > > Anyone has used LPC2366 usb as cdc class?
> > > I am using the sample from NXP and the comunication
> > > is very slow not baudrate, but the accept new packets.
> > > Has anyone experience this problem?
> >
> > can you write a bit more in detail, what (software) parts
> > you are using? Do you use some version (which?) of
> > nxpusblib or some other USB software published by NXP?
> >
> > Which driver are you using on PC side? I assume you are using
> > a Windows OS (which?). Are you using just a INF file
> > or a INF / sys driver published by NXP?
> >
> > Could it have something to do with ZLP (zero length packets)?
> > Which side is slow? When the device is sending something
> > to the PC or the other side, when PC is sending something
> > to the device? What do you mean by "slow"?
> >
> > Best regards,
> >
> > Martin
>