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).