AnsweredAssumed Answered

HCS12 Interrupts (bootloader and main firmware)

Question asked by Viacheslav Balandin on Apr 19, 2017
Latest reply on Apr 22, 2017 by Edward Karpicz

Hi. Sorry for my poor English.
I'm using 9s12e64 MCU and trying to write my own bootloader (it does not use interrupts) IDE CW5.1 + processor expert

 

Bootoader placed at address 0xe000-0xffff. Secondary interrupt table placed at 0xdf80-0xdfff Bootloader works fine, gets firmware, jumps to main application. Main app works. But there is on issue: I can't use interrupts in my main application. when interrupt occurs, MCU "hangs" (LED stops blinking) I've read AN2153, looked through AN2153SW and CW & HC12D60A VECTOR RELOCATION 

Can anyone help me?

Here is some pieces of my code, where can be mistake:

 

// Events.c (bootloader)

#pragma CODE_SEG __NEAR_SEG NON_BANKED

void extVpwmesdn (void) { asm JMP [0xDF88,pcr]; }
void extVvreglvi (void) { asm JMP [0xDF8A,pcr]; }
....

#pragma CODE_SEG DEFAULT

 

// Vectors.c (bootloader)

static const tIsrFunc _InterruptVectorTable[] @0xFF80U = { /* Interrupt vector table */
/*lint -restore Enable MISRA rule (1.1) checking. */
/* ISR name No. Address Pri Name Description */
&Cpu_Interrupt, /* 0x3F 0xFF80 1 ivVReserved63 unused by PE */
....
&extVpwmesdn, /* 0x3B 0xFF88 1 ivVpwmesdn used by PE */

......

 

// interrupt, that does not works properly in main app:

#pragma CODE_SEG __NEAR_SEG NON_BANKED
ISR(FC1_Interrupt)
{
TIM2_TFLG1 = 0x80U; /* Reset interrupt request flag */
FC1_OnInterrupt(); /* Invoke user event */
}

#pragma CODE_SEG FC1_CODE

 

Attached screenshots of PE CPU settings for main app

Outcomes