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/MSP430F5528: Initiate PU.0 and PU.1 as GPIOs

Prodigy 110 points

Replies: 3

Views: 55

Part Number: MSP430F5528

Tool/software: Code Composer Studio

I am new to the MSP430 software, I am using the MSP430F5528 with the MSP-TS430RGC64USB breakout board for testing.

I am trying to configure Port PU for output, to do a basic LED blink function. I want to use both PU.0 and PU.1, and have the LED’s blink separately, controlled by two separate functions.

I am having problems initiating the Port PU.

I read the Data Sheet for my particular chip, but with my limited knowledge the information was not particularly helpful to me. Here is the Data Sheet Information:

To which I produced the following code:

       PUSEL |= BIT0;             //SEL set GPIO BIT0 sets as output

       PUOPE |= BIT1;

       PUOUT0 |= BIT1;            //Sets PU.0 as High

       PUOUT1 |= BIT1;            //Sets PU.0 as High

After reading thought several Forums and MSP430 GPIO tutorials, I produced the following code to initiate the pins/ports.

       PUSEL |= BIT0;             //SEL set GPIO BIT0 sets as output

       PUOPE |= BIT1;

       PUOUT |= BIT0 | BIT1;            //Sets PU.0 & PU.1 as High

Both Codes failed

For both codes I received the Errors:

“#138 expression must be modifiable lvalue” for lines PUSE,  PUOPE, and PUOUT0/PUOUT1

“#20 identifier “PUOUT” is undefined” for line PUOUT.

I am not sure where to go from here. I have searched the web for code samples to initiate the pins/ports but most information is about the LDO and changing the output voltage.

I hope you can help me with this problem and inform me what I am doing wrong.

3 Replies

  • Hi Nicole,

    You can find code examples for MSP430 devices at https://www.ti.com/tool/MSPDRIVERLIB or https://www.ti.com/tool/MSPWARE.

    You will find a few examples for configuring GPIOs which you can use as a starting point to develop your application.

    In the case of PU, to use them as output pins, you need to set PUSEL to 0 & PUOPE to 1. See Table 6-58. Port PU (PU.0/DP, PU.1/DM) Output Functions of the device data sheet (https://www.ti.com/lit/gpn/msp430f5528). 

    Also please see section 42.4.1.3 USBPHYCTL Register in the MSP430F5xx Family User's Guide at www.ti.com/.../slau208

    The registers PUSEL, PUOPE, PUOUT0 & PUOUT1 are part of the USBPHYCTL register.

    Srinivas

  • In reply to Srinivas Lingam:

    Thank you for the information.

    After reading the data sheet, Table 6-58 for Port PU and the Family User's Guide. I am still at a lost for how to initiate this port.

    After reading I understand that the USPPHYCTL can only be modified when the USBKEYPID is unlocked. (This would explain the Error message #138 I am receiving.)  From Table 42-6, I understand that USBKEY must be written to 9628h to ‘unlock’ the register. And the register must be unlocked for me to configure the registers PUSEL, PUOPE etc…

    I guess my question now is what syntax do I use to configure the USBKEY.

    I am not experienced enough with coding to understand what the manual means by “written”. I am assuming Written means Set, using either, “=”, “|=” or “&=”, none of which worked and caused another #138 error. 

  • In reply to Nicole Carpenter:

    After working thought the code a little more, I realized my mistake with writing the USBKEY to hex.

    The line of code was accepted, no error, but the PUSEL, PUOPE etc... were still marked as Error #138.

    I then tried initiating the USBPHYCTL register, which these set functions fall under. After doing some research I added the following code.

    USBKEYPID = 0x9628;     //This "unlocks" the configuration registers

    USBPHYCTL |= PUOPE;       //Enables USBPHYCTL Register required for next lines

    The USBPHYCTL was accepted but I still could not modify the PUSEL, PUOPE etc… (I continue getting the #138 Error message). I continued to read through the Family User's Guide, but no farther information was given on this register.

    Can you direct me where I need to go from here?

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.