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.
尊敬的团队:
我使用 PD7作为 GPIO 输出引脚来驱动 LED。
我 是 MSP432E401Y SDK、在学习 TRM 后 、我必须知道 PD7引脚 已锁定。
2.如何使用 GPIO 驱动程序 API 调用解锁寄存器。
此致、
Naga Narasimha Rao
您好、Naga、
请尝试以下操作并查看其是否正常工作。
1) 1)包含头文件:
#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"
步骤2)使用以下代码:
HWREG(GPIO_PORTD_AHB_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTD_AHB_BASE+GPIO_O_CR) |= GPIO_PIN_7;
此致、
Ralph Jacobi
尊敬的 Ralph Jacobi:
感谢您的回复。 如上所述、添加头文件。
1.我没有在以下路径中找到以下两个文件,并且找 不到错误文件。
#include "ti/devices/msp432e4/driverlib/inc/hw_types.h"
#include "ti/devices/msp432e4/driverlib/inc/hw_memmap.h"
2.我尝试了以下由 TI 建议的代码以及在运行以下代码时使用的代码。 控制将默认处理程序。
//首先解锁
HWREG (GPIO_PORTD_BASE + GPIO_O_LOCK)= GPIO_LOCK_KEY;//解锁
HWREG (GPIO_PORTD_BASE + GPIO_O_CR)|= 0x80);//写入提交寄存器
// HWREG (GPIO_PORTD_BASE + GPIO_O_AFSEL)&&~0x80;//禁用备用功能
// HWREG (GPIO_PORTD_base + GPIO_DEN)|= 0x80;//启用数字驱动器
HWREG (GPIO_PORTD_BASE + GPIO_O_LOCK)= 0;//锁定引脚
此致、
Naga Narasimha Rao P
您好、Naga、
我将进一步对此进行研究。
此致、
Ralph Jacobi
您好、Naga、
[引用 userid="526381" URL"~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1189804/msp432e401y-gpio-pin-of-portd-pd7-pin-not-able-to-drive-the-led/4483133 #4483133]2. 我尝试了 TI 建议的以下代码以及运行以下代码时的代码。 控制将转到默认处理程序。您是否首先启用了 GPIO? 请参见下面的。 如果在启用 GPIO 之前尝试解锁端口、则会导致故障。
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
根据我在 GPIO_JTAG 示例中看到的内容、应该可以使用以下内容:
GPIOD->LOCK = GPIO_LOCK_KEY; GPIOD->CR = 0x80; GPIOD->AFSEL &= 0xf7; GPIOD->LOCK = GPIO_LOCK_KEY; GPIOD->CR = 0x00; GPIOD->LOCK = 0;
如果这不起作用、我准备了另一个应该起作用的解决方案、但我想坚持 MSP432E4 SDK 通常使用的解决方案。
此致、
Ralph Jacobi