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.

  • Resolved

CCS/MSP430FR5994: msp430fr5994.h version 1210 (CCS 10.1.0) is missing Digital I/O Base Address Definition

Intellectual 780 points

Replies: 5

Views: 112

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

I was previously working with CCS 9.1 and decided to migrate to the most recent version of CCS 10. I was surprised when my GPIO functionally for my application stopped working. Turns our that the header msp430fr5994.h for CCS 10 had its Port 1 - 8 base address definitions removed. 

#define __MSP430_HAS_DIO__                    /* Definition to show that module is available */
#define __MSP430_BASEADDRESS_DIO__ 0x0200
#define DIO_BASE               __MSP430_BASEADDRESS_DIO__
#define __MSP430_HAS_PORTA_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTA_R__ 0x200
#define PA_BASE                __MSP430_BASEADDRESS_PORTA_R__
#define __MSP430_HAS_PORTJ_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTJ_R__ 0x320
#define PJ_BASE                __MSP430_BASEADDRESS_PORTJ_R__
#define __MSP430_HAS_PORT1_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT1_R__ 0x200
#define P1_BASE                __MSP430_BASEADDRESS_PORT1_R__
#define __MSP430_HAS_PASEL0__                 /* Define for DriverLib */
#define __MSP430_HAS_PASEL1__                 /* Define for DriverLib */
#define __MSP430_HAS_PJSEL0__                 /* Define for DriverLib */
#define __MSP430_HAS_PJSEL1__                 /* Define for DriverLib */
#define __MSP430_HAS_P1SEL0__                 /* Define for DriverLib */
#define __MSP430_HAS_P1SEL1__                 /* Define for DriverLib */

The previous version of this same header was: 

#define __MSP430_HAS_DIO__                    /* Definition to show that module is available */
#define __MSP430_BASEADDRESS_DIO__ 0x0200
#define DIO_BASE               __MSP430_BASEADDRESS_DIO__
#define __MSP430_HAS_PORTA_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTA_R__ 0x200
#define PA_BASE                __MSP430_BASEADDRESS_PORTA_R__
#define __MSP430_HAS_PORTB_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTB_R__ 0x220
#define PB_BASE                __MSP430_BASEADDRESS_PORTB_R__
#define __MSP430_HAS_PORTC_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTC_R__ 0x240
#define PC_BASE                __MSP430_BASEADDRESS_PORTC_R__
#define __MSP430_HAS_PORTD_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTD_R__ 0x260
#define PD_BASE                __MSP430_BASEADDRESS_PORTD_R__
#define __MSP430_HAS_PORTJ_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORTJ_R__ 0x320
#define PJ_BASE                __MSP430_BASEADDRESS_PORTJ_R__
#define __MSP430_HAS_PORT1_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT1_R__ 0x200
#define P1_BASE                __MSP430_BASEADDRESS_PORT1_R__
#define __MSP430_HAS_PORT2_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT2_R__ 0x200
#define P2_BASE                __MSP430_BASEADDRESS_PORT2_R__
#define __MSP430_HAS_PORT3_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT3_R__ 0x220
#define P3_BASE                __MSP430_BASEADDRESS_PORT3_R__
#define __MSP430_HAS_PORT4_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT4_R__ 0x220
#define P4_BASE                __MSP430_BASEADDRESS_PORT4_R__
#define __MSP430_HAS_PORT5_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT5_R__ 0x240
#define P5_BASE                __MSP430_BASEADDRESS_PORT5_R__
#define __MSP430_HAS_PORT6_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT6_R__ 0x240
#define P6_BASE                __MSP430_BASEADDRESS_PORT6_R__
#define __MSP430_HAS_PORT7_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT7_R__ 0x260
#define P7_BASE                __MSP430_BASEADDRESS_PORT7_R__
#define __MSP430_HAS_PORT8_R__                /* Definition to show that port is available */
#define __MSP430_BASEADDRESS_PORT8_R__ 0x260
#define P8_BASE                __MSP430_BASEADDRESS_PORT8_R__

Please be aware if this bug, as it will break GPIO related code of people who switch to CCS 10. 

 

  • Hi, Eddie,

    I can run my FR5994 Launchpad well with P1.0 LED blink. 

    In the header file MSP430FR5994.h, the definition is different from previous CCS version. The PORT1,2,3.. are defined separately with the based address. 

    #define __MSP430_HAS_DIO__ /* Definition to show that module is available */
    #define __MSP430_BASEADDRESS_DIO__ 0x0200
    #define DIO_BASE __MSP430_BASEADDRESS_DIO__
    #define __MSP430_HAS_PORTA_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORTA_R__ 0x200
    #define PA_BASE __MSP430_BASEADDRESS_PORTA_R__
    #define __MSP430_HAS_PORTB_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORTB_R__ 0x220
    #define PB_BASE __MSP430_BASEADDRESS_PORTB_R__
    #define __MSP430_HAS_PORTC_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORTC_R__ 0x240
    #define PC_BASE __MSP430_BASEADDRESS_PORTC_R__
    #define __MSP430_HAS_PORTD_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORTD_R__ 0x260
    #define PD_BASE __MSP430_BASEADDRESS_PORTD_R__
    #define __MSP430_HAS_PORTJ_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORTJ_R__ 0x320
    #define PJ_BASE __MSP430_BASEADDRESS_PORTJ_R__
    #define __MSP430_HAS_PORT1_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT1_R__ 0x200                                            //  --------  this is the port1 base address
    #define P1_BASE __MSP430_BASEADDRESS_PORT1_R__
    #define __MSP430_HAS_PORT2_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT2_R__ 0x200
    #define P2_BASE __MSP430_BASEADDRESS_PORT2_R__
    #define __MSP430_HAS_PORT3_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT3_R__ 0x220
    #define P3_BASE __MSP430_BASEADDRESS_PORT3_R__
    #define __MSP430_HAS_PORT4_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT4_R__ 0x220
    #define P4_BASE __MSP430_BASEADDRESS_PORT4_R__
    #define __MSP430_HAS_PORT5_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT5_R__ 0x240
    #define P5_BASE __MSP430_BASEADDRESS_PORT5_R__
    #define __MSP430_HAS_PORT6_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT6_R__ 0x240
    #define P6_BASE __MSP430_BASEADDRESS_PORT6_R__
    #define __MSP430_HAS_PORT7_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT7_R__ 0x260
    #define P7_BASE __MSP430_BASEADDRESS_PORT7_R__
    #define __MSP430_HAS_PORT8_R__ /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT8_R__ 0x260
    #define P8_BASE __MSP430_BASEADDRESS_PORT8_R__

    .....

    SFR_8BIT(P1IN); /* Port 1 Input */
    SFR_8BIT(P2IN); /* Port 2 Input */
    SFR_8BIT(P2OUT); /* Port 2 Output */
    SFR_8BIT(P1OUT); /* Port 1 Output */                          //  --------  this is the port1 register definition
    SFR_8BIT(P1DIR); /* Port 1 Direction */
    SFR_8BIT(P2DIR); /* Port 2 Direction */
    SFR_8BIT(P1REN); /* Port 1 Resistor Enable */
    SFR_8BIT(P2REN); /* Port 2 Resistor Enable */
    SFR_8BIT(P1SEL0); /* Port 1 Select 0 */
    SFR_8BIT(P2SEL0); /* Port 2 Select 0 */
    SFR_8BIT(P1SEL1); /* Port 1 Select 1 */
    SFR_8BIT(P2SEL1); /* Port 2 Select 1 */
    SFR_8BIT(P1SELC); /* Port 1 Complement Select */
    SFR_8BIT(P2SELC); /* Port 2 Complement Select */
    SFR_8BIT(P1IES); /* Port 1 Interrupt Edge Select */
    SFR_8BIT(P2IES); /* Port 2 Interrupt Edge Select */
    SFR_8BIT(P1IE); /* Port 1 Interrupt Enable */
    SFR_8BIT(P2IE); /* Port 2 Interrupt Enable */
    SFR_8BIT(P1IFG); /* Port 1 Interrupt Flag */
    SFR_8BIT(P2IFG); /* Port 2 Interrupt Flag */
    SFR_8BIT(P3IN); /* Port 3 Input */
    SFR_8BIT(P4IN); /* Port 4 Input */
    SFR_8BIT(P3OUT); /* Port 3 Output */
    SFR_8BIT(P4OUT); /* Port 4 Output */
    SFR_8BIT(P3DIR); /* Port 3 Direction */
    SFR_8BIT(P4DIR); /* Port 4 Direction */
    SFR_8BIT(P3REN); /* Port 3 Resistor Enab

    ...

    Please double check your header file. But I am running the code example on CCS10.0.0. Do you see and difference from CCS10.1.0?

    Thanks, 

    Lixin 

  • In reply to Lixin Chen1:

    I'm sorry, I should have been more specific. I was trying to use GPIO_enableInterrupt() from driverLib. This function worked with the header from version CCS 9.1 but the function stopped working when I migrated to CCS10.1.0.

    void GPIO_enableInterrupt(uint8_t selectedPort,
                              uint16_t selectedPins) {
        uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort];
    
        #ifndef NDEBUG
        if(baseAddress == 0xFFFF)
        {
            return;
        }
        #endif
    
        // Shift by 8 if port is even (upper 8-bits)
        if((selectedPort & 1) ^ 1)
        {
            selectedPins <<= 8;
        }
    
        HWREG16(baseAddress + OFS_PAIE) |= selectedPins;
    }

    When my parameters were GPIO_PORT_P6 and GPIO_PIN3, baseAddress would return 0xFFFF, which is obviously a problem. From gpio.c :

    static const uint16_t GPIO_PORT_TO_BASE[] = {
        0x00,
    #if defined(__MSP430_HAS_PORT1_R__)
        __MSP430_BASEADDRESS_PORT1_R__,
    #elif defined(__MSP430_HAS_PORT1__)
        __MSP430_BASEADDRESS_PORT1__,
    #else
        0xFFFF,
    #endif
    #if defined(__MSP430_HAS_PORT2_R__)
        __MSP430_BASEADDRESS_PORT2_R__,
    #elif defined(__MSP430_HAS_PORT2__)
        __MSP430_BASEADDRESS_PORT2__,
    #else
        0xFFFF,
    #endif
    #if defined(__MSP430_HAS_PORT3_R__)
        __MSP430_BASEADDRESS_PORT3_R__,
    #elif defined(__MSP430_HAS_PORT3__)
        __MSP430_BASEADDRESS_PORT3__,
    #else
        0xFFFF,
    #endif
    #if defined(__MSP430_HAS_PORT4_R__)
        __MSP430_BASEADDRESS_PORT4_R__,
    #elif defined(__MSP430_HAS_PORT4__)
        __MSP430_BASEADDRESS_PORT4__,
    #else
        0xFFFF,
    #endif
    #if defined(__MSP430_HAS_PORT5_R__)
        __MSP430_BASEADDRESS_PORT5_R__,
    #elif defined(__MSP430_HAS_PORT5__)
        __MSP430_BASEADDRESS_PORT5__,
    #else
        0xFFFF,
    #endif
    #if defined(__MSP430_HAS_PORT6_R__)
        __MSP430_BASEADDRESS_PORT6_R__,
    #elif defined(__MSP430_HAS_PORT6__)
        __MSP430_BASEADDRESS_PORT6__,
    #else
        0xFFFF,
    #endif

    Since __MSP430_HAS_PORT6_R__  is no longer in msp430fr5994.h, __MSP430_BASEADDRESS_PORT6_R__ becomes defined as 0xFFFF. 

    In other words, the msp430fr5994.h in CCS10.1.0 becomes incompatible with gpio.c in driverLib of MSPWare.

  • In reply to Eddie Carrera:

    I looked at the header included with TI GCC and it seems to have a similar problem. The version from the latest installation (9.2) has just three HAS_PORT symbols defined while the 4.1 and 8.3 versions have twelve defined.

  • In reply to Eddie Carrera:

    Hi, Eddie, 

    Thanks to report this. I will ask software expert about this. 

    Thanks, 

    Lixin

  • In reply to Lixin Chen1:

    Hello,

    This looks like a regression in the header file as these defines were inadvertently removed. We're looking into resolving the issue.

    A couple workarounds you can do in the meantime:

    • Modify the driverlib source files to always have those ports enabled
    • Copy the older header files into the newer IDE

    Regards,
    Zack

    ----------------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    ----------------------------------------------------------------------------------------------------------------

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.