TI中文支持网
TI专业的中文技术问题搜集分享网站

急! 28035程式加入CLA interrupt就會進__interrupt void ILLEGAL_ISR(void)

Hi TI的各位專家大家好

我目前有一個程式會跳進__interrupt void ILLEGAL_ISR(void)的問題想要相您們請教

1. 原本我使用的中斷有

interrupt void CPU_timer_isr(void)    100k的中斷速度

interrupt void epwm1_timer_isr(void)      100k的中斷速度

interrupt void epwm4_timer_isr(void)      5k的中斷速度

interrupt void SCI_RX_isr(void)     目前沒有資料進來所以不會觸發中斷

而且我將以下的程式都放到RAM去執行

#pragma CODE_SECTION(CPU_timer_isr,"ramfuncs");//將中斷程式CPU_timer_isr放置於RAM裡執行。
#pragma CODE_SECTION(FBLLC_voltage_loop_compensate,"ramfuncs");
#pragma CODE_SECTION(FBLLC_current_loop_compensate,"ramfuncs");
#pragma CODE_SECTION(PWM_operation_mode_control,"ramfuncs");
#pragma CODE_SECTION(phase_shift_PWM_generate,"ramfuncs");

#pragma CODE_SECTION(epwm1_timer_isr,"ramfuncs");
#pragma CODE_SECTION(epwm4_timer_isr,"ramfuncs");
#pragma CODE_SECTION(VI_ADC_get_result,"ramfuncs");
#pragma CODE_SECTION(get_ADC_information,"ramfuncs");
#pragma CODE_SECTION(timer_5k_control,"ramfuncs");

2. 我想要加入CLA幫忙我分擔我CPU_timer_isr的運算壓力,因此

2.1  CLA的設定程式

void Init_CLA(void)
{

EALLOW;
PieVectTable.CLA1_INT1 = &cla1_task1_isr;
EDIS;

memcpy(&Cla1funcsRunStart, &Cla1funcsLoadStart, (Uint32)&Cla1funcsLoadSize);
memcpy(&Cla1mathTablesRunStart, &Cla1mathTablesLoadStart, (Uint32)&Cla1mathTablesLoadSize);

EALLOW;
Cla1Regs.MVECT1 = 0x0000;//(Uint16)((Uint32)&Cla1Task1 – (Uint32)&Cla1Prog_Start);//0x0000;//
EDIS;

EALLOW;
Cla1Regs.MPISRCSEL1.bit.PERINT1SEL = CLA_INT1_NONE;
Cla1Regs.MIER.bit.INT1 = 1;
EDIS;

EALLOW;
Cla1Regs.MMEMCFG.bit.PROGE = 1;
Cla1Regs.MCTL.bit.IACKE = 1;
Cla1Regs.MMEMCFG.bit.RAM0E = CLARAM0_ENABLE;
Cla1Regs.MMEMCFG.bit.RAM1E = CLARAM1_ENABLE;
SysCtrlRegs.PCLKCR3.bit.CLA1ENCLK = 1; //add for Don
EDIS;

}

2.2  CLA程式

__interrupt void Cla1Task1 ( void )
{
//__mdebugstop();

if(PWM_test_CLA > 299)PWM_test_CLA = 0;
PWM_test_CLA++;

if(Don_test == 0)
{
Don_test = 1;
}
else
{
Don_test = 0;
}

// Cla1Regs.MICLR.bit.INT1 = 1;
// PieCtrlRegs.PIEACK.bit.ACK11 = 1;
}

__interrupt void cla1_task1_isr( void)
{
//PieCtrlRegs.PIEACK.bit.ACK11 = 1;
PieCtrlRegs.PIEACK.all = (PIEACK_GROUP1 | PIEACK_GROUP3 | PIEACK_GROUP8 | PIEACK_GROUP9 | PIEACK_GROUP11);
}

2.3  CLA變數宣告

#pragma DATA_SECTION(Don_test,"Cla1ToCpuMsgRAM")
Uint16 Don_test = 0;
#pragma DATA_SECTION(PWM_test_CLA,"Cla1ToCpuMsgRAM")
Uint16 PWM_test_CLA = 0;

2.4  CLA的運算在CPU_timer_isr程式中被觸發

interrupt void CPU_timer_isr(void)
{
GpioDataRegs.GPASET.bit.GPIO9 = 1;

FBLLC_current_loop_compensate();

FBLLC_voltage_loop_compensate();

PWM_operation_mode_control();

phase_shift_PWM_generate(FBLLC.compensate.PWM_value, 20); // {switch frequency} {dead time}.

Cla1ForceTask1();

EPwm2Regs.CMPA.half.CMPA = PWM_test_CLA;

GpioDataRegs.GPACLEAR.bit.GPIO9 = 1;

PieCtrlRegs.PIEACK.all = (PIEACK_GROUP1 | PIEACK_GROUP3 | PIEACK_GROUP8 | PIEACK_GROUP9 | PIEACK_GROUP11);
}

3. 程式執行後的結果是當我EINT;與ERTM;之後,程式開始會有中斷,這時候我的程式就有機會進入以下的程式中,導致我的程式無法繼續動作

__interrupt void ILLEGAL_ISR(void) // Illegal operation TRAP
{
// Insert ISR Code here

// Next two lines for debug only to halt the processor here
// Remove after inserting ISR Code
__asm(" ESTOP0");
for(;;);

}

4. 我有試著用__mdebugstop();去查看程式是否有執行Cla1Task1 ( void ),結果發現是有的,只是隨機運行0~3次就會跳到無限迴圈了。

5. 我嘗試過關閉Cla1Regs.MIER.bit.INT1為0,發現程式就能正常動作了,因此推斷應該是我的CLA interrupt造成程式進入__interrupt void ILLEGAL_ISR(void)

6. 我的F28035_CLA_C.cmd檔案內容如下

_Cla1Prog_Start = _Cla1funcsRunStart;
-heap 0x200
-stack 0x200

CLA_SCRATCHPAD_SIZE = 0x100;
–undef_sym=__cla_scratchpad_end
–undef_sym=__cla_scratchpad_start

MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAML3 : origin = 0x009000, length = 0x001000 /* on-chip RAM block L3 */
OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */
FLASHH : origin = 0x3E8000, length = 0x002000 /* on-chip FLASH */
FLASHG : origin = 0x3EA000, length = 0x002000 /* on-chip FLASH */
FLASHF : origin = 0x3EC000, length = 0x002000 /* on-chip FLASH */
FLASHE : origin = 0x3EE000, length = 0x002000 /* on-chip FLASH */
FLASHD : origin = 0x3F0000, length = 0x002000 /* on-chip FLASH */
FLASHC : origin = 0x3F2000, length = 0x002000 /* on-chip FLASH */
FLASHA : origin = 0x3F6000, length = 0x001F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL_P0 : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */

IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */
IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */

ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
/* Registers remain on PAGE1 */
BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML0 : origin = 0x008000, length = 0x000800 /* on-chip RAM block L0 */
CLARAM0 : origin = 0x008800, length = 0x000400
CLARAM1 : origin = 0x008C00, length = 0x000400

CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080
CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080
FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */

}

SECTIONS
{

/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHC PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAMM0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
LOAD_SIZE(_RamfuncsLoadSize),
RUN_START(_RamfuncsRunStart),
PAGE = 0

csmpasswds : > CSM_PWL_P0 PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0

/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.cio : > RAML0 PAGE = 1
.sysmem : > RAMM1 PAGE = 1
.ebss : > RAML0 PAGE = 1
.esysmem : > RAML0 PAGE = 1

/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0
/* Allocate IQ math areas: */
IQmath : > FLASHA PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
.bss_cla : > CLARAM1, PAGE = 1
Cla1Prog : LOAD = FLASHD,
RUN = RAML3,
LOAD_START(_Cla1funcsLoadStart),
LOAD_END(_Cla1funcsLoadEnd),
RUN_START(_Cla1funcsRunStart),
LOAD_SIZE(_Cla1funcsLoadSize),
PAGE = 0
Cla1ToCpuMsgRAM : > CLA1_MSGRAMLOW, PAGE = 1
CpuToCla1MsgRAM : > CLA1_MSGRAMHIGH, PAGE = 1
Cla1DataRam0 : > CLARAM0, PAGE = 1
Cla1DataRam1 : > CLARAM1, PAGE = 1
GROUP : LOAD = FLASHB,
RUN = CLARAM1,
LOAD_START(_Cla1mathTablesLoadStart),
LOAD_END(_Cla1mathTablesLoadEnd),
RUN_START(_Cla1mathTablesRunStart),
LOAD_SIZE(_Cla1mathTablesLoadSize),
PAGE = 1
{
CLA1mathTables
.const_cla
} CLAscratch : { *.obj(CLAscratch)
. += CLA_SCRATCHPAD_SIZE;
*.obj(CLAscratch_end) } > CLARAM1,
PAGE = 1

.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT

}

7. 請問為什麼會產生這個問題?我能怎麼解決??

感謝~

Don

Rayna Wang:

下面是关于如何debug illegal ISR的网址,请参考。

http://processors.wiki.ti.com/index.php/Interrupt_FAQ_for_C2000#The_ITRAP_Interrupt

赞(0)
未经允许不得转载:TI中文支持网 » 急! 28035程式加入CLA interrupt就會進__interrupt void ILLEGAL_ISR(void)
分享到: 更多 (0)