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.

TM4C1230C3PM: Unable to unlock the PF[0] pin

Part Number: TM4C1230C3PM

Hello,

Given the part number TMC1230C3PM I am not able to unlock the PF0 pin in order to configure it as CAN.

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    while (!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF));

    HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0;

    GPIOPinConfigure(GPIO_PF0_CAN0RX);
    GPIOPinConfigure(GPIO_PF3_CAN0TX);

    GPIOPinTypeCAN(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_3);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CAN0)){}

    CANInit(CAN0_BASE);

    ui32CanBitRate = CANBitRateSet(CAN0_BASE, ui32SysClock, 1000000u);
    CANIntEnable(CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS);

    CANEnable(CAN0_BASE);

The value of the register 

GPIO_PORTF_LOCK_R
is alwasys 1.

Thank you,

  • Hi,

      I also see the same thing. I even try on PortC using the gpio_jtag example in the TivaWare library and the LOCK_R is 1 after unlocking it. I'm not too sure what is the reason. However, the pin is actually unlocked for the alternate functionality. In the case of PortC, it is by default used for JTAG pins. After unlocking it, I can change PortC to GPIO although reading the LOCK_R register returns 1. Can you check your CAN0RX pin and see if it is working? 

  • Hello,

    Unfortunatelly, I do not receive anything on that pin.

  • Hi,

      I don't have a EVM board with CAN transceiver to test out PF0 in CAN functionality. However, I unlock and configure PF0 for timer0 T0CCP0 as a PWM pin. It is working. I can see the PWM signal on PF0. Therefore, the unlock is working. I intentionally comment out the unlocking operation and I will not see any signal on PF0,  I have captured the PortF registers. See below.  Can you show yours? I want to see if any registers are written in your portF registers. As you can see in mine, the GPIO_PCTL is changed to 0x7 which is selecting T0CCP0. Yours would have been 0x3 if CAN0RX is chosen. I notice that when I single step through the line HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY,  it will first change to 0. However, it will change back to 0x1 after the line HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x01 is executed. This maybe an artifact of the operation as the CR register does change to its new programmed value. 

  • Hello Charles,

    Thanks a lot for your support!

    While reading your reply i figured out the root cause. Well, like almost all the time the problem lies between chair and keyboard! It was a bug in my SW thus stopping sending data over CAN port.

    I appreciate your time and support and keep in touch!

    Best Regards,