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.

trying to find TivaWare CDC device example for DK-TM4C129X dev kit

Other Parts Discussed in Thread: EK-TM4C1294XL

I have a DK-TM4C129X dev kit and am trying to find an example of how to use the TivaWare USB library to configure the board as a CDC device that talks to a PC via a virtual comm port. The usb_dev_serial project that is included in the TivaWare download sets things up for a composite CDC device that routes the USB to a UART. I am looking for an example that just reads data from the PC via the USB and transmits stuff back. A simple USB echo program.

As I recall, the USB API for the MSP430 had such an example program. Does something similar exist for TivaWare?

Thanks,

Dave

  • Hello Dave,

    There are two such examples

    1. C:\ti\TivaWare_C_Series-2.1.0.12573\examples\boards\ek-tm4c1294xl\usb_dev_cserial which is for EK-TM4C1294XL but can be easily adapted to the DK-TM4C129
    2. C:\ti\TivaWare_C_Series-2.1.0.12573\examples\boards\dk-tm4c129x\usb_dev_bulk which uses Bulk Endpoint for sending data to-from PC (though not on a COM port)

    Regards
    Amit
  • Thanks for the quick response, Amit. I will check those out.


    Regards,

    Dave

  • Amit,

    I took a look at the two examples you referenced. Neither does what I am looking for.

    The first one is the same as I had already looked at. It creates 2 virtual com ports and routes data to the UART. The second does not create a virtual comm port at all. I just need a really simple example of creating a single com port and echoing back the received characters.

    I will continue playing with the usb_dev_serial example to see if I can hack it up to do what I want, but it seems like a simple echo example would be very useful for TI to provide.

    Regards,

    Dave
  • Hello Dave,

    The method in the second example can be used to modify the first example to return the character.

    The main reason behind not echoing it back to the Serial COM Port was that it would more closely resemble the ICDI operation for USB-UART conversion.

    Regards
    Amit
  • In case someone else might be looking for the answer to this in the future, I was able to hack up the usb_dev_serial project by removing all the UART stuff and replacing the USB_EVENT_RX_AVAILABLE event handling code in RxHandler() with the following:

    case USB_EVENT_RX_AVAILABLE:
    {
    uint32_t numRxBytes;
    uint8_t rxBuffer[128];

    numRxBytes = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, rxBuffer, 128);

    USBBufferWrite((tUSBBuffer *)&g_sTxBuffer,
    (unsigned char *)rxBuffer, numRxBytes);

    break;
    }

    This will echo back received packets to the sender, assuming the packets are all 128 bytes or smaller.