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

USB CDC-ACM function class

Hi,

I use a modified version of Keil's USB CDC-ACM function class implementation. It works really well but I am having a problem in the way I am using it.
I use the virtual COM-port to connect as a modem to the host PC.
My target connects through PPP to the USB CDC-ACM input/output. This allows me to create multiple sockets for multi-channel TCP/IP communication. This creates the problem! With increasing communication throughput my application showes signs of instability.
I am looking for a way how I could limit the data throughput at the USB device level.
Could someone provide me with an feasable example of how to achieve this?
I appreciate your help - thank you!

-Frank

Parents
  • "I return if the packet is not ready. The function is then called again in USB_SOF_Event () until a packet is ready and can be processed."

    I see, I remember the details of this engine.
    Once RD_EN bit is enabled on the USB Control register (USBCtrl) to read out the Receive Packet Length register (USBRxPLen), we should read out the endpoint buffer, too. Then, we can't get the packet length without reading out the buffer. Inconvenient feature.

    Then, instead of reading out the exact packet length, we have to assume it full length, 64 bytes. "Select Endpoint" command shows the buffer is empty or not.

    a) bulk OUT EP
    In USB_SOF_Event() (usb_user.c) [b]AND[/b] USB_EndPoint2() ISR - USB_EVT_OUT selector, call this subroutine.

    - Check the FE bit of "Select Endpoint" command, if the EP buffer is empty, return
    - - WrCmd( CMD_SEL_EP(EPAdr(CDC_DEP_IN)) ); if ( CMD_DATA & EP_SEL_F == 0 ) return;
    - If the room on the RX buffer is less than 64 bytes, return
    - read out to the RX buffer using USB_ReadEP()
    - - USB_ReadEP( CDC_DEP_IN, RX_buffer )

    Tsuneo

Reply
  • "I return if the packet is not ready. The function is then called again in USB_SOF_Event () until a packet is ready and can be processed."

    I see, I remember the details of this engine.
    Once RD_EN bit is enabled on the USB Control register (USBCtrl) to read out the Receive Packet Length register (USBRxPLen), we should read out the endpoint buffer, too. Then, we can't get the packet length without reading out the buffer. Inconvenient feature.

    Then, instead of reading out the exact packet length, we have to assume it full length, 64 bytes. "Select Endpoint" command shows the buffer is empty or not.

    a) bulk OUT EP
    In USB_SOF_Event() (usb_user.c) [b]AND[/b] USB_EndPoint2() ISR - USB_EVT_OUT selector, call this subroutine.

    - Check the FE bit of "Select Endpoint" command, if the EP buffer is empty, return
    - - WrCmd( CMD_SEL_EP(EPAdr(CDC_DEP_IN)) ); if ( CMD_DATA & EP_SEL_F == 0 ) return;
    - If the room on the RX buffer is less than 64 bytes, return
    - read out to the RX buffer using USB_ReadEP()
    - - USB_ReadEP( CDC_DEP_IN, RX_buffer )

    Tsuneo

Children