AnsweredAssumed Answered

CW and 9S12X:I'm not able to route interrupt to XGATE

Question asked by diego colombo on Jun 26, 2012
Latest reply on Jun 26, 2012 by diego colombo

Hi,help needed from Milan,Italy


I want to use the XGATE coprocessor in  a 9S12X Freescale uC
I followed indications in AN3144 but i cant reach the interrupt routine
for XGATE in case oft PeriodicInterrupTimer0 interrupt,so i ask your help:


The interrupt is correctly managed if routed to the main CPU

If i try to route it to the XGATE the program goes to :

ISR(Cpu_Interrupt)
{
  asm(BGND);
 }
without passing through the default interrupt handler,

why?

I tried to resume the code.
From main i call SetupXGate()


static void SetupXGATE(void)
 {
   XGVBR= (unsigned int)(void*__far)(XGATE_MyVectorTable -
   XGATE_VECTOR_OFFSET);
    ROUTE_INTERRUPT(PIT_VEC, 0x81); /* RQST=1 and PRIO=1 */
    XGMCTL= 0xFBC1; /* XGE | XGFRZ | XGIE */
  }

 i supposed PIT_VEC=0x7A:in AN3144 is used SCI0_VEC=0xD6;If this is from the
main CPU vectors table- > PIT_VEC=0x7A,right?

I put in the .cxgate file the XGATE vector table and the interrupts handlers:

#include <hidef.h>
 #include "xgate.h"
 #include "intrinsics_xgate.h"

//the following 3 rows are from Simple SCI.mc example
 #pragma push
 #pragma DATA_SEG XGATE_DATA
 #pragma pop
 //***************************default handler****************************
 interrupt void ErrorHandler(int dataptr)
 {
   int chanNum= dataptr;
   asm BRK;
 }
 //***************************my handler****************************
 interrupt void PIT_Thread(int myint)
 {
   //toggle a pin ,check on oscilloscope
   if(PORTB & 0x1)PORTB &=~0x1;
   else           PORTB |= 0x1;
 }
 //******* XGATE vector table*****************
 /* assign the vector table in separate segment for dedicated placement in
linker parameter file */
 #pragma CONST_SEG XGATE_VECTORS

const XGATE_TableEntry XGATE_MyVectorTable[] = {
                           // Channel # = Vector address / 2
  /* channel 0..8 are not used, first used must match macro
XGATE_VECTOR_OFFSET in xgate.h */
  {ErrorHandler, 0x09},  // Channel 09 - Reserved
  {ErrorHandler, 0x0A},  // Channel 0A - Reserved
  .....
  .....
   {ErrorHandler, 0x39},  // Channel 39 - XGATE Software Trigger 0
  {ErrorHandler, 0x3A},  // Channel 3A - Periodic Interrupt Timer
  {ErrorHandler, 0x3B},  // Channel 3B - Periodic Interrupt Timer
  {ErrorHandler, 0x3C},  // Channel 3C - Periodic Interrupt Timer
  {PIT_Thread, 0x3D},  // Channel 3D - Periodic Interrupt Timer //***
  {ErrorHandler, 0x3E},  // Channel 3E - Reserved
  {ErrorHandler, 0x3F},  // Channel 3F - Autonomous Periodical interrupt API
  .....
  .....
 };

Thank you for your attention and any hint

please forgive not proper use of english language

Diego

Outcomes