我想将PB7_GPIO15设置成普通的GPIO输出口,文档上说要进行特殊设置,请问要如何设置?
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_7);这样设置成输出口,
然后GPIOPINWrite(GPIO_PORTB_BASE,GPIO_PIN_7,0);这样是不行的。无法设置成功。
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.
我想将PB7_GPIO15设置成普通的GPIO输出口,文档上说要进行特殊设置,请问要如何设置?
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_7);这样设置成输出口,
然后GPIOPINWrite(GPIO_PORTB_BASE,GPIO_PIN_7,0);这样是不行的。无法设置成功。
我在文档里看到这一段“The GPIO commit control registers provide a layer of protection against accidental programming of critical
hardware peripherals. Protection is provided for the NMI pin (PB7). Writes to protected bits of the GPIO
Alternate Function Select (GPIOAFSEL) register, GPIO Pull Up Select (GPIOPUR) register, GPIO Core
Select (GPIOCSEL) register, and GPIO Digital Enable (GPIODEN) register are not committed to storage
unless the GPIO Lock (GPIOLOCK) register has been unlocked and the appropriate bits of the GPIO
Commit (GPIOCR) register have been set”
所以我在Blink程序中加入
HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;
HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x80;
HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) &= 0x7f;
HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = 0;
程序下入后无反应,且
c28程序没有反应,然后我点击暂停,显示 no source available for 0想001552