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.

Compiler/MSP430FR2311: GPIO driver library issue? Cannot recompile MSP-EXP430FR2311: Out-of-box experience code

Part Number: MSP430FR2311

Tool/software: TI C/C++ Compiler

I have downloaded, compiled and debugged out-of-box experiance code. Seems to run fine but the led-output is not affected by ambient light.

The issue seems to be that the compiler does no longer generate correct code with GPIO-driver library:

main.c (line 85) calls   initGPIO();

initGPIE (main.c line 263-268) is:

GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,GPIO_PIN0,GPIO_PRIMARY_MODULE_FUNCTION);

GPIO_PORT_P2 is defined as 2

the "setAsPeripheralModuleFunctionOutputPin"  starts with a table-lookup:

 uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort];

But this table has the following content (from debugger):

GPIO_PORT_TO_BASE
0000 0200 FFFF FFFF FFFF

So entry 2 returns FFFF

The problem might be the macro for this table in gpio.c (line 53...):

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

The file "MSP430fr2311h" has define for Port1 (with base address 0x200) but not for port2.

Why? Used to work earlier (before upgrading to latest CCS).

  • Hello Sven,

    First, I want to thank you for the very detailed post and for bringing this to our attention. I was able to duplicate this issue on my side. I think there may be a discrepancy between the DriverLib file(s) and the header file related to Port A (which includes Ports 1 and 2) or Port 2 usage.

    As a workaround, I added the following code to the 'msp430fr2311.h' file after Line 1592, recompiled the project and verified that LED2 varied its brightness based on ambient light levels. I'll report this internally to hopefully get resolved soon.

    #define __MSP430_HAS_PORT2_R__                /* Definition to show that port is available */
    #define __MSP430_BASEADDRESS_PORT2_R__ 0x200
    #define P1_BASE                __MSP430_BASEADDRESS_PORT1_R__

    Regards,

    James