我想将PB7_GPIO15设置成普通的GPIO输出口,文档上说要进行特殊设置,请问要如何设置?
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_7);这样设置成输出口,
然后GPIOPINWrite(GPIO_PORTB_BASE,GPIO_PIN_7,0);这样是不行的。无法设置成功。
zhuoying wang:
我在文档里看到这一段“The GPIO commit control registers provide a layer of protection against accidental programming of criticalhardware peripherals. Protection is provided for the NMI pin (PB7). Writes to protected bits of the GPIOAlternate Function Select (GPIOAFSEL) register, GPIO Pull Up Select (GPIOPUR) register, GPIO CoreSelect (GPIOCSEL) register, and GPIO Digital Enable (GPIODEN) register are not committed to storageunless the GPIO Lock (GPIOLOCK) register has been unlocked and the appropriate bits of the GPIOCommit (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