Dear Team,
I am using PD7 as GPIO output pin to drive the LED.
1. I am MSP432E401Y SDK and after studying TRM i got to know that PD7 pin is locked.
2. How to unlock the register using GPIO driver API calls.
Regards,
Naga Narasimha Rao
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.
Dear Team,
I am using PD7 as GPIO output pin to drive the LED.
1. I am MSP432E401Y SDK and after studying TRM i got to know that PD7 pin is locked.
2. How to unlock the register using GPIO driver API calls.
Regards,
Naga Narasimha Rao
Hello Naga,
Try the following and see if that works.
1) Include Header files:
#include "ti/devices/msp432e4/driverlib/inc/hw_types.h" #include "ti/devices/msp432e4/driverlib/inc/hw_gpio.h" #include "ti/devices/msp432e4/driverlib/inc/hw_memmap.h"
Step 2) Use the following code:
HWREG(GPIO_PORTD_AHB_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTD_AHB_BASE+GPIO_O_CR) |= GPIO_PIN_7;
Best Regards,
Ralph Jacobi
Dear Ralph Jacobi,
Thanks for your reply. as of you told above to include Header files.
1. I did not find below two files in below path and I got error file not found.
#include "ti/devices/msp432e4/driverlib/inc/hw_types.h"
#include "ti/devices/msp432e4/driverlib/inc/hw_memmap.h"
2. I tried below code which is suggested by TI and when i run the below code. Control is going to default handler.
// first we unlock
HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK)= GPIO_LOCK_KEY; // UNLOCK
HWREG(GPIO_PORTD_BASE + GPIO_O_CR) |= 0x80); // write to commit register
// HWREG(GPIO_PORTD_BASE + GPIO_O_AFSEL)&= ~0x80; // disable alternate function
// HWREG(GPIO_PORTD_BASE + GPIO_O_DEN)|= 0x80; // enable digital driver
HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK)= 0; // lock pin
Regards,
Naga Narasimha Rao P
Hello Naga,
2. I tried below code which is suggested by TI and when i run the below code. Control is going to default handler.
Have you enabled the GPIO first? See below. If you try and unlock the port before you enable the GPIO, it will cause a fault.
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
From what I am seeing based on the gpio_jtag example, the following should be possible to use:
GPIOD->LOCK = GPIO_LOCK_KEY; GPIOD->CR = 0x80; GPIOD->AFSEL &= 0xf7; GPIOD->LOCK = GPIO_LOCK_KEY; GPIOD->CR = 0x00; GPIOD->LOCK = 0;
If that doesn't work I have another solution lined up which should work, but I wanted to stick with what MSP432E4 SDK typically uses.
Best Regards,
Ralph Jacobi