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.

[参考译文] TM4C1290NCPDT:固件跳至错误的 ISR 功能

Guru**** 2516170 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1084863/tm4c1290ncpdt-firmware-jumps-to-wrong-isr-function

部件号:TM4C129ENCPDT

您好,  

我在 PD2和 PD3引脚上设置了两个中断。  但是,固件将始终跳至 PD3 (PS_RESET _REQ_PIN) ISR。

这是我对两个引脚的初始化。

//PD2 Pin = PS_ONOFF_REQ_PIN
void PS_ONOFF_Req_interrupt_enable(void)
{
    ROM_GPIOPinTypeGPIOInput(PS_PORT2, PS_ONOFF_REQ_PIN);
    IntMasterDisable();
    GPIOPinTypeGPIOInput(PS_PORT2, PS_ONOFF_REQ_PIN);
    GPIOPadConfigSet(PS_PORT2, PS_ONOFF_REQ_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);  // Enable weak pullup resistor for ADC_BUSY
    GPIOIntDisable(PS_PORT2, PS_ONOFF_REQ_PIN);        // Disable interrupt for ADC_BUSY (in case it was enabled)
    GPIOIntClear(PS_PORT2, PS_ONOFF_REQ_PIN);      // Clear pending interrupts for ADC_BUSY
    GPIOIntRegister(PS_PORT2, PSONOFFReqIntHandler);
    GPIOIntTypeSet(PS_PORT2, PS_ONOFF_REQ_PIN, GPIO_FALLING_EDGE);             // Configure for Rising and Falling Edge
    GPIOIntEnable(PS_PORT2, PS_ONOFF_REQ_PIN);     // Enable interrupt for ADC_BUSY
    IntMasterEnable();

}

//PD3 Pin = PS_RESET_REQ_PIN
void PS_LocalReset_Req_interrupt_enable(void)
{

    IntMasterDisable();
    ROM_GPIOPinTypeGPIOInput(PS_PORT2, PS_RESET_REQ_PIN);
    GPIOPinTypeGPIOInput(PS_PORT2, PS_RESET_REQ_PIN);
    GPIOPadConfigSet(PS_PORT2, PS_RESET_REQ_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);  // Enable weak pullup resistor for ADC_BUSY
    GPIOIntDisable(PS_PORT2, PS_RESET_REQ_PIN);        // Disable interrupt for ADC_BUSY (in case it was enabled)
    GPIOIntClear(PS_PORT2, PS_RESET_REQ_PIN);      // Clear pending interrupts for ADC_BUSY
    GPIOIntRegister(PS_PORT2, PSResetReqIntHandler);
    GPIOIntTypeSet(PS_PORT2, PS_RESET_REQ_PIN, GPIO_FALLING_EDGE);             // Configure for Rising and Falling Edge
    GPIOIntEnable(PS_PORT2, PS_RESET_REQ_PIN);     // Enable interrupt for ADC_BUSY
    IntMasterEnable();

}
 

下面是两个中断的 ISR 中断处理程序;

//Interrupt handler for PD3 (PS_RESET_REQ_PIN)
void PSResetReqIntHandler(void)
{
    GPIOIntClear(PS_PORT2, PS_RESET_REQ_PIN);
    UARTprintf("\r\nLocal Reset button pressed");

}

//Interrupt handler for PD2 (PS_ONOFF_REQ_PIN)
void PSONOFFReqIntHandler(void)
{
    GPIOIntClear(PS_PORT2, PS_ONOFF_REQ_PIN);

    UARTprintf("\r\nLocal On button pressed");

}
 

有什么想法吗?

谢谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好,Sahil,

    每引脚中断仅在端口 P 和 Q 上可用。对于端口 D,所有引脚都由一个中断处理,因此您无法分解 ISR。 您可以检查哪个引脚触发中断,然后使用 GPIOIntStatus 执行代码。

    此致,

    拉尔夫·雅各比

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好,拉尔夫,

    如何检查哪个针脚触发了中断? 您是指正在读取中断状态寄存器? 是否可以共享中断寄存器名称等?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好,Sahil,

    是的, 这就是 GPIOIntStatus 的帮助。 它将识别触发中断的确切引脚。

    下面是蒂瓦瓦尔的 API 说明:

    //! Gets interrupt status for the specified GPIO port.
    //!
    //! \param ui32Port is the base address of the GPIO port.
    //! \param bMasked specifies whether masked or raw interrupt status is
    //! returned.
    //!
    //! If \e bMasked is set as \b true, then the masked interrupt status is
    //! returned; otherwise, the raw interrupt status is returned.
    //!
    //! \return Returns the current interrupt status for the specified GPIO module.
    //! The value returned is the logical OR of the \b GPIO_INT_* values that are
    //! currently active.

    此致,

    拉尔夫·雅各比

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢拉尔夫的帮助。