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/TMS320F28069F: Question on usb_dev_bulk example, how can I tx data to Txbuffer only after device gets request from host

Part Number: TMS320F28069F


Tool/software: Code Composer Studio

Looks like the usb_dev_bulk example put the data into TxBuffer once it receives a character by calling EchoNewDataToHost().

If I understand right, can I do it in a different way, which is, the device only puts data into TxBuffer when host requests it?
Is there a related EVENT can be put into TxHandler like this?

uint32_t
TxHandler(void *pvCBData, uint32_t ulEvent, uint32_t ulMsgValue,
void *pvMsgData)
{
//
// No action is required in response to any transmit event in this example.
// All that is done is to update the transmit counter.
//
if(ulEvent == USB_EVENT_TX_COMPLETE)
{
g_ulTxCount += ulMsgValue;
}

return(0);
}

uint32_t
TxHandler(void *pvCBData, uint32_t ulEvent, uint32_t ulMsgValue,
          void *pvMsgData)
{
    switch(ulEvent)
    //
    // No action is required in response to any transmit event in this example.
    // All that is done is to update the transmit counter.
    //
    case USB_EVENT_TX_COMPLETE:
    {
        g_ulTxCount += ulMsgValue;
        break;
    }
    //

    case USB_EVENT_TX_REQUEST:
    {
        usbdatatx();
        break;
    }

    return(0);
}

Thanks in advance

  • Hi Wang Ning,

    Thank you for your question. Your thread has been assigned to a C2000 expert and should be replied soon.

    Best regards,
    Chen
  • Wang,

    I believe this is possible. The USB controller should get an interrupt when the host send a DATA IN packet requesting data.

    You will need to modify the USB example accordingly. I do not think you will need to modify the USB Library as such, just the handlers and application code.

    sal
  • Hi Sal

    Although not 100% sure, I have a feel that there is no interrupt generated for bulk in device, after I read through F2806x USB library USER GUIDE and also the thread below
    e2e.ti.com/.../2273294
    So in my case(I am developing a senor generating data continuously), it starts writing USBbuffer and transfer to TX FIFO(64bytes) before host requesting. this results in 64bytes FIFO data transferred first at the next host request.
  • Hi Wang,

    This sounds correct. And that post you found is helpful. Thank you for searching the forum for answers.

    It looks like the way in the example is the only way to do it. You will need to write to the USB Buffer which will then get written to the FIFO. Then, once an IN packet is received, the device will respond by sending a data packet. Then you should receive a TX interrupt.

    Regards,

    sal