丁丁

LM3S9B96将PB7(NMI)配置成GPIO使用

0
阅读(4208)

LM3S9B96将PB7(NMI)配置成GPIO使用

画板子的时候把NMI弄成GPIO了,关键的还是一根控制线,真是杯具了,最后看到可以把JTAG解锁的,看来NMI也可以解锁,参考JTAG解锁的代码,解锁成功,NMI当作GPIO使用.

HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;

HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x0F;

// Now modifiy the configuration of the pins that we unlocked.

// Note that the DriverLib GPIO functions may need to access

// registers protected by the lock mechanism so these calls should

// be made while the lock is open here.

HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) &= 0xf0;

GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,  GPIO_PIN_7);

// Finally, clear the commit register and the lock to prevent

// the pin configuration from being changed accidentally later.

// Note that the lock is closed whenever we write to the GPIO_O_CR

// register so we need to reopen it here.

HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD;

HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0x00;

HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = 0;