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/MSP430F5659: Need example for setting USB DP/DM as GPIO

Part Number: MSP430F5659

Tool/software: Code Composer Studio

My application board has the USB pins exposed but was never used. I currently find myself in need of a spare GPIO so I would like to re-purpose the data pins. Can I get pointed to the right documentation for how to set the pins, or maybe a simple snippet of what registers should be set to configure the USB_DP pin as an output high?

Thanks,

  • From 5xx / 6xx family datasheet (slau208)...

    42.2.1 USB Transceiver (PHY)
    The physical layer interface (USB transceiver) is a differential line driver directly powered from VUSB (3.3
    V). The line driver is connected to the DP and DM pins, which form the signaling mechanism of the USB
    interface.
    When the PUSEL bit is set, DP and DM are configured to function as USB drivers controlled by the USB
    core logic. When the bit is cleared, these two pins become "Port U", which is a pair of high-current general
    purpose I/O pins. In this case, the pins are controlled by the Port U control registers. Port U is powered
    from the VUSB rail, separate from the main device DVCC. If these pins are to be used, whether for USB
    or general purpose use, it is necessary that VUSB be properly powered from either the internal regulators
    or an external source.

    BTW, you can use PORT J also, if there is no bootcode / PORT J related errata.

  • Thanks very much for this snippet. It should be good to get me started. I will let you know if I have any questions or if I got it working.

    Thanks,
  • Hi Sheldon,

    please find the information you need in the MSP430F5659 Datasheet.

    Page 37 Section LDO and PU Port gives the following note: "The Port U Pins (PU.0 and PU.1) function as general-purpose high-current I/O pins. These pins can only be configured together as either both inputs or both outputs."

    Table 69 and 70 on page 108 then describe the pin functionality at the according bit settings. This is according to the register settings described in the MSP430x5xx and MSP430x6xx Famil User's Guide section 12.4.9 through 12.4.14.

    I hope this helps.

    Best regards,

    Britta

  • In regards to the Port U pins in the datasheet, it then goes on to say that the PU port is only accessible for MSP430F645x and MSP430F535x devices. Does this mean that I cannot use these pins as outputs on the MSP430f5659, or that I need to access them in a different manner than the PU interface?
  • I'm sorry but I can't find the section.
    Could you help me by indicating in which section you found that note?

    Thanks,
    Britta
  • Page 37 of the MSP430F5659 datasheet. Its the last line in the section you referenced.

  • Hi,

    sorry for the confusion. So, the LDO-PWR module is only available on the MSP430F645x and MSP430F535x devices but this does not mean that Port U is not available. Essentially, Port U is available for both devices with and without USB. For your application you can disregard the comment as the MSP430F5659 has USB capability but you want to use the DP and DM pins as GPIO.

    Please go ahead and configure the Port and Pins as indicated before. The configuration and register setting applies as normal (see User's Guide for the details).

    Let me know if you have further questions.

    Best regards,
    Britta
  • Hi Sheldon,

    did the GPIO configuration of the USB pins work out for you?
    Please click the "Verify answer" button if the answer helped you to solve your issue. If not, can I help you with your current status?

    Thanks and best regards,
    Britta
  • Its still a little unclear to me what registers I need to set to access Port U as a GPIO. This port isn't explicitly defined in the msp430 board header file and I also can't find it when looking at the register table while debugging the device. It seems like it must be handled through the USB registers entirely which seems a contradictory to what you mentioned above. Going back to my original question, would it be possible to get a very small example of what registers are being set to make these pins go High or Low?
  • Thanks zrno soli. It looks like if I externally supply 3.3v to the usb ldo the following code should set the pins high

    USBKEYPID = 0x9628;
    USBPHYCTL |= (PUOPE|PUOUT1|PUOUT0);
    USBKEYPID = 0x9600;

    For my application I think re-purposing a uart pin previously used for system debug will be better than attempting to use port u.

    Thanks.

**Attention** This is a public forum