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.

[参考译文] TMS320F280025:硬故障处理程序-如何使用回调?

Guru**** 2540720 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1272334/tms320f280025-hardfault-handler---how-to-use-a-callback

器件型号:TMS320F280025

您好!

我已经看到、硬故障中断位于 interrupt.h 内(至少在通用电机控制项目中)。 因此、当在运行时某种程度上发生硬故障时、它会跳到那里而不执行任何操作。 因此、由于 interrupt.h 是一个库和唯一的参考、我不想修改此文件、并且我的问题是、如何在电机在此 ISR 内挂起之前注册自己的回调来关闭电机? 我从其他制造商那里知道、他们只有弱 ISR 例程、然后我可以定义自己的例程来轻松解决该问题。

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

    尊敬的 Sebastian:

    您可以浏览一下与您的问题类似的帖子吗?

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/22586/280x-illegal-instruction-interrupt

    谢谢。

    嘉兴市

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

    你好、这并不是我的问题。 我的问题非常具体、关于通用电机控制 SDK 示例。

    这些用作 driverlib 中的 interrupt.h 的驱动程序。 任何硬故障都将导致 ISR 跳转至 interrupt.h 内的特定例程

    由于该库仅用作示例中的参考、因此如果不对特性进行大量修改、我就无法直接访问这些回调。

    整个项目。

    以下是 interrupt.h 中的 Interrupt_DefaultHandler 的示例:

    //*****************************************************************************
    //
    //! \internal
    //! The default interrupt handler.
    //!
    //! This is the default interrupt handler.  The Interrupt_initVectorTable()
    //! function sets all vectors to this function.  Also, when an interrupt is
    //! unregistered using the Interrupt_unregister() function, this handler takes
    //! its place.  This should never be called during normal operation.
    //!
    //! The ESTOP0 statement is for debug purposes only. Remove and replace with an
    //! appropriate error handling routine for your program.
    //!
    //! \return None.
    //
    //*****************************************************************************
    static void Interrupt_defaultHandler(void)
    {
        uint16_t pieVect;
        uint16_t vectID;
    
        //
        // Calculate the vector ID. If the vector is in the lower PIE, it's the
        // offset of the vector that was fetched (bits 7:1 of PIECTRL.PIEVECT)
        // divided by two.
        //
        pieVect = HWREGH(PIECTRL_BASE + PIE_O_CTRL);
        vectID = (pieVect & 0xFEU) >> 1U;
    
        //
        // If the vector is in the upper PIE, the vector ID is 128 or higher.
        //
        if(pieVect >= 0x0E00U)
        {
            vectID += 128U;
        }
    
        //
        // Something has gone wrong. An interrupt without a proper registered
        // handler function has occurred. To help you debug the issue, local
        // variable vectID contains the vector ID of the interrupt that occurred.
        //
        ESTOP0;
        for(;;)
        {
            ;
        }
    }

    其中指出 ESTOP 仅用于调试、应替换为错误处理例程。

    那么、我能够以某种方式简单地针对应用程序中的任何硬故障注册错误回调、还是我真的需要

    来修改 interrupt.h?

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

    您好、Sebastian、

    您是否能够使用压电输出和矢量 ID 来确定正在触发哪个中断、提示它 没有 配置为 ISR? 如果可能的话、你还能列举你正在使用的中断、你想要列出这些中断吗?

    此致、

    阿米尔·奥马尔

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

    尊敬的 Amir:

    谢谢、我可以解决这个问题、只需注册一个中断、它就会采用新的处理程序。