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.

[参考译文] TMS320F28379D:delay_US () 函数非法 ISR 问题

Guru**** 2551110 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1549751/tms320f28379d-issue-with-the-delay_us-function-illegal_isr

部件号:TMS320F28379D


工具/软件:

您好:

我的 delay_US () 函数有问题,我有一个程序,每秒和每 2 秒使用 CpuTimer 0.1 和 2 生成中断。 一切都按预期运行。 我已经在主循环中添加了 delay_us 函数、但无论向该函数添加了什么值、一旦启动程序、它就会停止而不会显示错误消息。 CCS 指的是第 164 行的 F2837xD/DefaultISR.c:

中断无效非法 ISR (void)

  //
  //在此处插入 ISR 代码
  //

  //
  //接下来的两行调试仅用于暂停此处的处理器
  //插入 ISR 代码后删除
  //
  ASM(“   ESTOP0“);  (第 164 行)
  for(;;);
}

我尝试在 F2837xD/examples 中将时钟频率设置为 200MHz、但没有发生任何事情、问题是恒定的。

有任何线索吗? 如果您有任何疑问、请随时与我联系。

提前感谢您、

Florentin  

#include "F28x_Project.h"
#include "driverlib.h"
#include "F2837xD_device.h"
#include "F2837xD_Adc_defines.h"

#include "device.h"
#include "math.h"
#include "string.h"
#include "stdlib.h"
#include "stdint.h"

#define _LAUNCHXL_F28379D

__interrupt void cpu_timer0_isr(void);
__interrupt void cpu_timer1_isr(void);
__interrupt void cpu_timer2_isr(void);
void ConfigurationADC(void);

int main(void)
{
    InitSysCtrl();
    InitGpio();

   // GPIO_SetupPinMux(65, GPIO_MUX_CPU1, 0);
   // GPIO_SetupPinOptions(65, GPIO_OUTPUT, GPIO_PUSHPULL);

    DINT;


    InitPieCtrl();

    IER = 0x0000;
    IFR = 0x0000;


    InitPieVectTable();

    EALLOW;  // This is needed to write to EALLOW protected registers
    PieVectTable.TIMER0_INT = &cpu_timer0_isr;
    PieVectTable.TIMER1_INT = &cpu_timer1_isr;
    PieVectTable.TIMER2_INT = &cpu_timer2_isr;
    EDIS;    // This is needed to disable write to EALLOW protected registers

    InitCpuTimers();   // For this example, only initialize the Cpu Timers

//
// Configure CPU-Timer 0, 1, and 2 to interrupt every second:
// 200MHz CPU Freq, 1 second Period (in uSeconds)
//
    ConfigCpuTimer(&CpuTimer0, 200, 2000000);
    ConfigCpuTimer(&CpuTimer1, 200, 1000000);
    ConfigCpuTimer(&CpuTimer2, 200, 1000000);

//
// To ensure precise timing, use write-only instructions to write to the
// entire register. Therefore, if any of the configuration bits are changed in
// ConfigCpuTimer and InitCpuTimers (in F2837xD_cputimervars.h), the below
// settings must also be updated.
//
    CpuTimer0Regs.TCR.all = 0x4000;
    CpuTimer1Regs.TCR.all = 0x4000;
    CpuTimer2Regs.TCR.all = 0x4000;

// Enable CPU int1 which is connected to CPU-Timer 0, CPU int13
// which is connected to CPU-Timer 1, and CPU int 14, which is connected
// to CPU-Timer 2:

    IER |= M_INT1;
    IER |= M_INT13;
    IER |= M_INT14;

// Enable TINT0 in the PIE: Group 1 interrupt 7
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;

// Enable global Interrupts and higher priority real-time debug events:
    EINT;  // Enable Global interrupt INTM
    ERTM;  // Enable Global realtime interrupt DBGM


    while(1)
    {
       DELAY_US(100);  


    }
}


void ConfigurationADC(void)
{
    EALLOW;
    AdcaRegs.ADCCTL2.bit.PRESCALE = 6;  //set ADDCLCK divider to 4
    AdcaRegs.ADCCTL2.bit.RESOLUTION = 0; //resolution de 12but mode, plus rapide    OU AdcSetMode(ADC_ADCA, 0, 0);
    AdcaRegs.ADCCTL2.bit.SIGNALMODE = 0; //Single-ended not differential
                                         //OU AdcSetMode(ADC_ADCA, 0, 0);   Pour RESOLUTION ET SIGNAL MODE  a la fois
    AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; //set the pulse postion to late
    AdcaRegs.ADCCTL1.bit.ADCBSY = 1; // Power the ADC
    DELAY_US(1000);
}


__interrupt void cpu_timer0_isr(void)
{
   CpuTimer0.InterruptCount++;

   //
   // Acknowledge this interrupt to receive more interrupts from group 1
   //
   PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

__interrupt void cpu_timer1_isr(void)
{
   CpuTimer1.InterruptCount++;
}


__interrupt void cpu_timer2_isr(void)
{
   CpuTimer2.InterruptCount++;
}