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.

TMS320F28388D: How to modify USB function for specific requirement

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Hi Expert,,

My customer are testing usb_ex4_dev_bulk example from C2000ware, there is no issue for the demo, but they want to do some modification of the code to meet their requirement.

          C:\ti\c2000\C2000Ware_4_01_00_00\driverlib\f2838x\examples\c28x\usb

1. Store first Byte of recevied data to tg_pui8USBRxBuffer[0] for teach time 

as below picture showed, they want every time the received data is align from tg_pui8USBRxBuffer[0], how to modify the code?

2. How to call function EchoNewDataToHost outside of function RxHandler

in the example, EchoNewDataToHost was called in function RxHandler, they want to call EchoNewDataToHost function in other ISR, 

but do not know how to do, because do not know how to set the pointer value of pvMsgData and psDevice. 

pvMsgData and psDevice value come from pvCBData, pvMsgData of RxHandler as below showed

but how to know where to set value of pvCBData, pvMsgData of RxHandler function? I search the RxHandler in CCS and find no info.

  • Hi, 

    Will get back to you by tomorrow on this.

    Best Regards

    Siddharth 

  • Siddharth,

    Thanks, customer just download C2000Ware_4_02_00_00 and find there have an update of USB example.

    it seem still there is no way to modify the code to meet the 2 requirements as talked above. 

    C:\ti\c2000\C2000Ware_4_02_00_00

    1. Store first Byte of recevied data to tg_pui8USBRxBuffer[0] for teach time  

    2. How to call function EchoNewDataToHost outside of function RxHandler

  • Strong,

    Am looking into it. Both of these are handled in the usb library

    1. Related to buffer management, the write index is incremented each time new data is received. 

    2. pvCBData is pointer to the bulk device instance, this should be accessible outside of ISR. 

    Will continue to  look into it and update you.

    Best Regards

    Siddharth 

  • Siddharth,

    Thanks for your reply.

    1. Related to buffer management, the write index is incremented each time new data is received. 

    --> as write index is incremented, if customer want to know the data length of currently received data, only way to get is by new write index minus old write index?

    2. there have another question about example code of C2000Ware_4_02_00_00, 

    for C2000Ware_4_01_00_00, there have usb_ex4_dev_bulk_structs.c and usb_ex4_dev_bulk_structs.h,

    customer can modify the below configuration, but there are no usb_ex4_dev_bulk_structs.c and usb_ex4_dev_bulk_structs.h in C2000Ware_4_02_00_00,

    how to do the same configuration in C2000Ware_4_02_00_00?

    //******************************************************************************
    tUSBDBulkDevice g_sBulkDevice =
    {
    USB_VID_TI_1CBE,
    USB_PID_BULK,
    500,
    USB_CONF_ATTR_SELF_PWR,
    USBBufferEventCallback,
    (void *)&g_sRxBuffer,
    USBBufferEventCallback,
    (void *)&g_sTxBuffer,
    g_ppui8StringDescriptors,
    NUM_STRING_DESCRIPTORS
    };

    //******************************************************************************
    //
    // Receive buffer (from the USB perspective).
    //
    //******************************************************************************
    uint8_t g_pui8USBRxBuffer[BULK_BUFFER_SIZE];
    uint8_t g_pui8RxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE];
    tUSBBuffer g_sRxBuffer =
    {
    false, // This is a receive buffer.
    RxHandler, // pfnCallback
    (void *)&g_sBulkDevice, // Callback data is our device pointer.
    USBDBulkPacketRead, // pfnTransfer
    USBDBulkRxPacketAvailable, // pfnAvailable
    (void *)&g_sBulkDevice, // pvHandle
    g_pui8USBRxBuffer, // pi8Buffer
    BULK_BUFFER_SIZE // ui32BufferSize
    };

  • Strong,

    1. For the first part, the buffer management is done in the USB Library. I am trying to figure out how the writeIndex can be accessed without any changes to be done in the USB Lib code.

    2. Sysconfig support was added for USB in the C2000Ware v4.02 release. Hence this configuration can now be done through SysConfig tool. It will generate the structs.c and structs.h files. 

    Will keep you posted. 

    Best Regards

    Siddharth

  • Strong,

    Can you download and try the 4.02 version of C2000WARE + USB SysConfig tool?

    Nima

  • This is what it looks like:

  • Nima,

    Thanks for your support, customer already fix the issue.

  • Thank you Strong!