AnsweredAssumed Answered

i.MX53 - Interrupt vector issue

Question asked by Tiago Silva on Feb 24, 2014
Latest reply on Jun 19, 2014 by Victor Saldana

Hello,

 

    I am working with i.MX535 QSB from Freescale in IAR EWARM. I had used GettingStarted example from IAR EWARM, modifying the project like shown below (main.c).

 

    I am not able to get interrupts in IRQ_Handler address (0x18), even enabling TZIC #39. Anyone could please help me to get my LED on P7_7 blinking?

 

    The code is working well when pooling GPTSR_bit.OF1 bit in while(1), like suggested in the original GettingStarted project. But I need to get interrupts directly from the interrupt vector, what I can easily do on ARM7 platform for example.

 

Thanks,

 

Tiago

 

/** include files **/

#include <Freescale/iomcimx535.h>

#include <intrinsics.h>

#include "board.h"

 

/* GPT1 Tick per second*/

#define GPT_TICK_PER_SEC   4

 

/** private data **/

static volatile Int8U Gpt1Counter;

volatile unsigned char flag0;

 

/**

*

*/

__irq void IRQ_Handler(void)

{

   __DSB();

   

   if (flag0 < 0xFF)

   {

      flag0++;

   }

   

   GPTSR_bit.OF1= 1;

   

   __DSB();

   

   return;

}

 

/**

*

*/

int main(void)

{

   // USER LED init - GPIO_7[7]

   IOMUXC_SW_MUX_CTL_PAD_PATA_DA_1_bit.MUX_MODE = 1;

   GPIO7_DR_bit.no7   = 0;

   GPIO7_GDIR_bit.no7 = 1;

 

   // Init GPT

   Gpt1Counter = 0;

   // Select CKIL for timer clock - Low Frequency Reference Clock

   GPTCR_bit.CLKSRC = 4;

   // Init the Timer prescaler

   GPTPR_bit.PRESCALER = 0;

   // Init timer tick interval

   GPTOCR1 = CKIL/GPT_TICK_PER_SEC;

 

   //Enable Interrup on compare

   GPTIR_bit.OF1IE = 1;

   // Enable GPT1

   GPTCR_bit.EN = 1;

 

   /* Configure TZIC Interrupt Controller */

   TZIC_ENSET1_bit.INTENSET39 = 1;

   TZIC_INTSEC1_bit.SECURE39 = 1;

   TZIC_PRIOMASK_bit.MASK = 0x1F;

   TZIC_PRIORITY9_bit.PRIO39 = 0x20;

   TZIC_INTCTRL = 0x80010001;  

 

   __enable_interrupt();

 

   while (1)

   {

      if (flag0)

      {

          flag0 = 0;

         ++Gpt1Counter;

         GPIO7_DR_bit.no7 = (1 & Gpt1Counter);

      }

   }

}

Outcomes