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.

Starterware/TM4C1290NCPDT: Unable to Get total Length from USBBufferDataAvailable during USB_EVENT_RX_AVAILABLE.

Part Number: TM4C1290NCPDT

Tool/software: Starterware

Dear All,

I have routine RxHandler and board is being configured as USB virtual Uart via CDC APIs.



Now i have to receive >64 bytes of frame from the USB so  if i did this usin below code i only got the Last bytes number from the received frame. i.e. if the frame is of 70 bytes then i got result as 6 bytes from  USBBufferDataAvailable routine 

        case USB_EVENT_RX_AVAILABLE:
        {
            //
            // Feed some characters into the UART TX FIFO and enable the
            // interrupt so we are told when there is more space.
            //

        	//
        	//	Read No of Bytes available in Rx Buffer
        	//
        	Rx_Buffer_Length = USBBufferDataAvailable(&g_sRxBuffer);

        	//
        	//	Read Data from RxBuffer & move it to RxFrame
        	//
        	ulRead = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, Rx_Frame, Rx_Buffer_Length);

        	if(ulRead)
        		USB_Decode_RxFrame_Send_TxFrame(Rx_Buffer_Length);

            break;

Can any method how to get full length of the received frame ?

  • Hello smit,

    To my understanding, the USB_EVENT_RX_AVAILABLE does not mean RX is finished and can be triggered multiple times before all data is received. Have you tried seeing if that case has triggered repeated times?

    Also which example are you using as a basis for this, and which version of TivaWare?
  • I have made my own code it runs fine all togther if i am using frame of <64 bcoz i got the number of bytes <64 but as i increase the frame >64 then the overwrtiing happen.

    How to overcome things is there any other method? please suggest if any 

  • Hello smit,

    Your problem sounds like it could be related to the ring buffer getting overwritten. What do you use for USBBufferInit for TX and RX?

    Can you post your full code? I don't have much to work with on this right now... And even if it's your own code, did you use any TI example as a baseline to start with which I can reference (as that is where my familiarity lies) in conjunction?