This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C1294KCPDT: USBDCDCPacketWrite is not giving the USB_EVENT_TX_COMPLETE.

Part Number: TM4C1294KCPDT

Tool/software: Code Composer Studio

I took the USb Serial Device sample application provided and changed the following things.

1. cbTxHandler & cbRxHandler is replaced in tUSBDCDCDevice as callback.

2. rxBuffer & txBuffer buffer with NULL for callback data.

3. USBBufferSpaceAvailable with USBDCDCTxPacketAvailable and USBBufferWrite with USBDCDCPacketWrite.

In this scenario, we are not getting the USB_EVENT_TX_COMPLETE event through cbTxHandler.

  • Hello,

    I do not understand why you are even attempting this modification to begin with. USBDCDCTxPacketAvailable and USBDCDCPacketWrite are already used as part of the USB Tx Buffer. These are then passed through into the USB stack via the USBBufferWrite and USBBufferSpaceAvailable API's.

    Your changes make no sense to me, and it doesn't surprise me that it is not working.

    Can you explain what you are trying to accomplish? Perhaps I can help explain why the USB library is setup the way it is.
  • Hi Ralph Jacobi,

    First of all, thank you for the reply.

    Yesterday we went through the codes of library available in web and saw that the callbacks will executed only when we execute buffer APIs

    Our thought process was different and thought that we can achieve this functionalities only using the USBDCDC calls without the help of Buffer APIs.

    Is it possible to achieve the functionality by only using USBDCDC APIs? Hope this answer is No.

    Could you please explain why we need these 2 layer(Buffer layer and CDC layer)?

  • Hello,

    The USB stack is designed to allow the support of multiple device classes. CDC, Bulk, etc. In order to enable this, the stack is set to run standard API's and have a single USB buffer to cover all the different classes to save in both complexity and memory space (especially RAM).

    The structures defined in usb_serial_structs.c (or it's equivalent) provide the link between CDC specific functions and the general USB library. This allows for general API's from usblib.h such as USBBufferWrite and USBBufferSpaceAvailable to be used across all types of USB device classes, as ultimately the specific calls such as for CDC will be used by the USB library when an API such as USBBufferWrite is given the CDC TX buffer structure, such as USBDCDCPacketWrite.
  • Hi Ralph Jacobi,

    Thank you for sharing the details. This helps.