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.

“UNLOCK problem with TM4C123GH6M PF0 Pin”



“UNLOCK problem with TM4C123GH6M PF0 Pin”

I’m using PF0 pin as SSI1 RX function, but PF0 default is NMI. I write the unlock PF0 code as the example showed in forum as follows.

 

    HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK)  = GPIO_LOCK_KEY;   //Unlock

    HWREG(GPIO_PORTF_BASE+GPIO_O_CR)   |= 0X01;     // Enable PF0 AFS

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);    GPIOPinConfigure(GPIO_PF0_SSI1RX);         

    HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) =0;          // Relock

It works well on the first time the program is debugged and PF0 is working as SSI1RX. But when the target board is reset or re-power on. The TM4C123G does not work and runs into a fault ISR which led to an infinite loop. After this it never works again, unless we comment the unlock program code. But if we do this, the PF0 function is default to NMI pin again.

How can I permanently set PF0 to SSI1RX function? 

  • 只有JTAG相关的四个脚和NMI复用的2个脚需要解锁。其他脚在功能切换时不需要考虑解锁。

    具体方法是在Lock寄存器写入KEY,然后再操作commit寄存器就好了。具体方法如下:

    10.2.4 Commit Control
    The GPIO commit control registers provide a layer of protection against accidental programming of
    critical hardware peripherals. Protection is provided for the GPIO pins that can be used as the four
    JTAG/SWD pins and the NMI pin (see “Signal Tables” on page 1330 for pin numbers). Writes to
    protected bits of the GPIO Alternate Function Select (GPIOAFSEL) register (see page 671), GPIO
    Pull Up Select (GPIOPUR) register (see page 677), GPIO Pull-Down Select (GPIOPDR) register
    (see page 679), and GPIO Digital Enable (GPIODEN) register (see page 682) are not committed to
    storage unless the GPIO Lock (GPIOLOCK) register (see page 684) has been unlocked and the
    appropriate bits of the GPIO Commit (GPIOCR) register (see page 685) have been set.

  • Please do not paste these official words. Could you provide real  CCS codes to realize this function? Or has anyone big boy really solved the problem? But I have tried. After unlock the PF0 pin, it works as SSI1_RX while the power is on. But if you reset the cpu or re-power on. The cpu will be locked, it won't work anymore. I hope someone could really make an experiment and provide a sound solution.

  • After unlock the PF0 pin, it works as SSI1_RX while the power is on. But if you reset the cpu or re-power on. The cpu will be locked, it won't work anymore. 

    不是每次都需要解锁的,手册中说,当他处于锁定状态时,需要解锁,当他处于解锁状态时,你写入值,会把他再次锁定,因此可以在解锁之前读取GPIOLOCK的值,使其处于锁定状态,再解锁,由于没有电路板,没法给你验证。可以在解锁前读取值,看看PF0是否还处于锁定状态。