This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2378 :Integeration of USB CDC with Ethernet Http Demo code

Hi Friends,

I am using the LPC2378 processor.

I have the USB CDC example code and Http Demo example code.

Both codes are working well in alone.
i want to integrate the USBCDC code and the Http code.

so i integrate the both code and connect the USB cable with the PC.

The USBCDC code is working well.

The problem is when i connect the Ethernet LAN cable i am not able to access the web page means i am not able to ping the address.I am getting the message "The connection has timed out".

Is this both USBCDC and http code wont work together?
should i disable any interrupt routine in the USB or http code?

please help me to solve this problem?

with regrads,
Murthy.R

  • "when i connect the Ethernet LAN cable i am not able to access the web page means i am not able to ping the address."

    The first thing to do is to confirm that the USB interrupt actually disturbs the TCP/IP stack process.

    a) Is the TCP/IP stack works without USB connection?
    b) First, connect USB cable to PC. After 20-30 sec, connect LAN cable. Does the TCP/IP stack work?
    c) First, connect LAN cable to PC and run the TCP/IP process. Then connect USB cable.

    If a) and b) works, but c) doesn't, it suggests the USB interrupt may disturb the stack. Otherwise, there is another problem on your code, such as initialization of the stack, or flag handling for common process between TCP/IP and USB. In the real application, your code has to work on all of above conditions.

    If it is proved that the USB interrupt actually disturbs TCP/IP stack, (I don't think so :-) ), apply nesting interrupt and give the higher priority to the TCP/IP than USB.

    USB supports intrinsic flow control mechanism on the hardware level without any intervention of the firmware, though Ethernet doesn't on the hardware layer. Then, USB allows less priority than TCP/IP stack.

    USB retries communication while the device is busy (NAKing) without error. The shortest timeout on the USB process is 50 ms of control transfer over the default endpoint. The timeout of the bulk endpoints of CDC is determined by the host app over serial API.

    Tsuneo

  • If you wrote the most of process in the bulk endpoints handler to combine TCP and USB, actually the USB interrupt disturbs the TCP stack. The bulk endpoints handler is called from the USB ISR. It's a likely story. In this case, you have to consider on the task scheduler.

    Tsuneo

  • Hi Tsuneo,
    Thanks for your suggestion.
    Now the problem is solved both USBCDC and Http code working together.

    The problem is not in a initialization,that is in the TCP/IP application code.

    thanks,

    with regards,
    Murthy.R

  • Murthy,

    Can you please send me the link of the USB CDC Code that you have? I have a demo here but its implementing a USB CDC to serial conveter. I want to revise it to make it a USB CDC alone.

    Thanks,

    Vic

  • "I want to revise it to make it a USB CDC alone."

    When you know these facts on USB CDC spec, it's deadly easy.

    1) Bulk IN/OUT endpoints
    You can make the handling of Bulk IN/OUT endpoints independent from the rest of CDC implementation. Actually, the transfer over these endpoints is not affected by any setting like baudrate, handshake lines (CTS/RST, DTR/DSR, etc).

    For bulk IN endpoints, ZLP (Zero-Length Packet) is always required when the transfer size is just the multiple of wMaxPacketSize (usually, 64 bytes for full-speed).

    2) Interrupt IN endpoint
    This endpoint is required on the descriptors.
    But you can leave it un-handled, when you don't use SerialState notification, which carries the signaling like DSR, DCD, parity error, etc.
    Of course, you can use these signaling for different purpose from the original function on RS232.

    3) Class specific requests
    At least, you have to keep the function just on the USB side.
    - SetLineCoding holds the line coding setting from host.
    - GetLineCoding returns this line coding setting, or the default one at the start up.
    - SetControlLineState, SendBreak: Just return "no error"

    You can use these setting for different purpose from the original function on RS232.

    Tsuneo

  • pls send me code of your USBCDC to my mail id

    MANJUNATHDL@GMAIL.com

    Advanced Thanx

  • Please ignore this troll !
    May you end up with this mega troll as an assistant if you do send him something :-)

  • Anyone answering to "please send me an email so I can rip your email address and spam you to death" requests have voided any rights to complain about spam.

  • I use LPC2378 in MCB2300 and I test usbcdc demo with VirtualCOM function and it works well. But when I change the bulk endpoint from EP2 to EP5, this demo works failed. In LPC2378 EP2 and EP5 are for bulk data transfer.

    There are three parts I modify for bulk EP5:
    (1) In usbdesc.c :
    /* Endpoint, EP5 Bulk Out */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_OUT(5), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(USB_CDC_BUFSIZE), /* wMaxPacketSize */ 0x00, /* bInterval: ignore for Bulk transfer */
    /* Endpoint, EP5 Bulk In */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(5), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(USB_CDC_BUFSIZE), /* wMaxPacketSize */ 0x00, /* bInterval: ignore for Bulk transfer */

    (2) In cdcuser.h :
    #define CDC_DEP_IN 0x85
    #define CDC_DEP_OUT 0x05

    (3) In cdcuser.c :
    void USB_EndPoint5 (DWORD event) { switch (event) { case USB_EVT_OUT: CDC_BulkOut (); /* data received from Host */ break; case USB_EVT_IN: CDC_BulkIn (); /* data expected from Host */ break; }
    }

    Does anybody know why. Thank you

  • Stay in your own thread, and don't attack every thread you can find that has with USB to do...
    http://www.keil.com/forum/docs/thread13496.asp