Tool/software: TI-RTOS
Dear forum,
some follow-up of the posting
After carefully reading the technical reference of the processor it became clear, that a locking mechanism blocks the digital functions of the pin to prevent unintended configuration of the pin as NMI.
It needs to be unlocked, e.g. by the following function:
#include <ti/drivers/GPIO.h> #include <ti/drivers/gpio/GPIOMSP432E4.h> #include <ti/devices/msp432e4/driverlib/gpio.h> #include <ti/devices/msp432e4/driverlib/inc/hw_gpio.h> #include <ti/drivers/power/PowerMSP432E4.h> #include <ti/devices/msp432e4/driverlib/types.h> static const uint_fast16_t powerMgrIds[] = { PowerMSP432E4_PERIPH_GPIOA, /* PORTA */ PowerMSP432E4_PERIPH_GPIOB, /* PORTB */ PowerMSP432E4_PERIPH_GPIOC, /* PORTC */ PowerMSP432E4_PERIPH_GPIOD, /* PORTD */ PowerMSP432E4_PERIPH_GPIOE, /* PORTE */ PowerMSP432E4_PERIPH_GPIOF, /* PORTF */ PowerMSP432E4_PERIPH_GPIOG, /* PORTG */ PowerMSP432E4_PERIPH_GPIOH, /* PORTH */ PowerMSP432E4_PERIPH_GPIOJ, /* PORTJ */ PowerMSP432E4_PERIPH_GPIOK, /* PORTK */ PowerMSP432E4_PERIPH_GPIOL, /* PORTL */ PowerMSP432E4_PERIPH_GPIOM, /* PORTM */ PowerMSP432E4_PERIPH_GPION, /* PORTN */ PowerMSP432E4_PERIPH_GPIOR, /* PORTR */ PowerMSP432E4_PERIPH_GPIOS, /* PORTS */ PowerMSP432E4_PERIPH_GPIOT, /* PORTT */ PowerMSP432E4_PERIPH_GPIOP, /* PORTP */ PowerMSP432E4_PERIPH_GPIOQ, /* PORTQ */ }; /* Returns the GPIO power resource ID */ #define getPowerResource(port) (powerMgrIds[port])
void GPIO_unlock(GPIO_PinConfig pinConfig) { uint_fast8_t pinMask = pinConfig & 0xFF; uint8_t port = (pinConfig >> 8) & 0xFF; Power_setDependency(getPowerResource(port)); uint32_t portBase = GPIOMSP432E4_getGpioBaseAddr(port); /* write magic value to lock register */ HWREG(portBase + GPIO_O_LOCK) = 0x4C4F434B; HWREG(portBase + GPIO_O_CR) = pinMask; }
Use it before GPIO_init as follows:
GPIO_unlock(GPIOMSP432E4_PD7);
GPIO_unlock(GPIOMSP432E4_PE7);