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.

USB Transmit and Receive LEDs with MSP430F6xx



Thinking of upgrading the MSP430 in our device to a MSP430F6.

We now use FTDI chip for USB but would use the built-in USB of the MSP430F6

The FTDI chip includes TXLED and RXLED pins for flashing LEDs when TXing ot RXing.

This is a nice feature for users to see that the USB is communicating.

Any ideas how one could implement similar using the MSP430F6?  Perhaps by polling or inserting lines into a driverlib ISR which would bring pins high or low to light the LEDs when the transceiver is sending or receiving?

Bry

  • As I understand, on your MSP430 device it was used UART for communication to PC (over FTDI USB-UART bridge). Now you want to replace old (MSP430 and FTDI combination) with MSP430F6xx. This is possible of course, but there is some job to do (replacing UART code with USB), and flashing RX/TX LEDs is smallest problem in that case. 

  • We would use USB Developers Package.  My question regards flashing RX/TX LEDs.  We find it very useful for users to be able to see the USB connection working by the flashing of the RX/TX LEDs both during enumeration and when characters are sent or received through USB.

    See pins 21 and 22 (RX/TX LEDs)

    http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf

    which makes it a piece of cake to implement the RX/TX LEDs

    So my question is not about converting UART code to USB code or how hard it would be to do so, but rather, is it possible to implement flashing RX/TX LEDs using output pins on the MSP430, when the MSP430’s transceiver is transmitting or receiving, perhaps by polling or by inserting a line of code in a USB related ISR located in driverlib or somewhere else, that would toggle RX/TX LEDs?

  • BRYAN BOARDMAN said:
    My question regards flashing RX/TX LEDs.  We find it very useful for users to be able to see the USB connection working by the flashing of the RX/TX LEDs both during enumeration and when characters are sent or received through USB.

    Your msp430 will process USB I/O anyway so it can flash LED's when I/O happening as well. It's no brainer.

  • Ok Guru good, a piece of cake.  Could you point to the cake? For example, given the code in the various main.c USB examples and in usbEventHandling.c, which event would one insert code to light the RX LED and the TX LED when the transceiver TXs or RXs and then turn them off when TX or RX is complete assuming CDC?

    Perhaps turn TX LED on when (in main.c examples):

    cdcSendDataInBackground() but this would not turn on the TX LED when enumerating.

    And turn TX LED off with (in usbEventHandling.c):

    BYTE USBCDC_handleSendCompleted (BYTE intfNum)

    Perhaps turn RX LED on (in usbEventHandling.c):

    //This event indicates that data has been received for interface intfNum, but no data receive operation is underway.

    BYTE USBHID_handleDataReceived (BYTE intfNum)

    And turn RX LED off (in usbEventHandling.c):

    // This event indicates that a receive operation on interface intfNum has just been completed.

    BYTE USBHID_handleReceiveCompleted (BYTE intfNum)

    or GURU is there a better, lower level way?

  • Turn LED on unconditionally in I/O completion callback or ISR. Turn LED off after some time - using (system ticks) timer.

  • BRYAN BOARDMAN said:

    We would use USB Developers Package.  My question regards flashing RX/TX LEDs.  We find it very useful for users to be able to see the USB connection working by the flashing of the RX/TX LEDs both during enumeration and when characters are sent or received through USB.

    So my question is not about converting UART code to USB code or how hard it would be to do so, but rather, is it possible to implement flashing RX/TX LEDs using output pins on the MSP430, when the MSP430’s transceiver is transmitting or receiving, perhaps by polling or by inserting a line of code in a USB related ISR located in driverlib or somewhere else, that would toggle RX/TX LEDs?

    At enumeration begining OS will reset USB device (MSP430F6xx) and this can be used for turning LED on as enumeration process indication. Turning LED on can be inserted in USB_reset function in usb.c. For example when CDC enumeration is done, OS will set control lines, and this can be used for turning LED off inside function usbSetControlLineState in usbcdc.c. Also, it can be used bEnumerationStatus ? ENUMERATION_COMPLETE or simply turn enumeration LED off inside usbSetConfiguration function, or USB_handleEnumCompleteEvent.
    Turning TX/RX LEDs on/off can be placed on different places in code, and finding best LED behavior can be done by testing. Of course, if CDC transfer with PC, open and close port, with every data transfer (if CDC port is not continually open), then it is much easier and can be done inside usbSetControlLineState.

**Attention** This is a public forum