AnsweredAssumed Answered

Possible Bug on ADuC7124?

Question asked by c.saller on Mar 19, 2018

Hello,

the last 2 days is had trouble with the interrupt on T1 (GP Timer). I found that the interrupt could not be cleared, even though T1CLRI was set to clear the interrupt and T1CON was set to 0x200 (disabled, with 32kHz Clk). So, the interrupt occured continously, blocking the whole program.

This did not happen when using the system clock (44MHz). 

Can anyone confirm this or correct my thinking?

 

Code snippet of working code:

int iFlag = 0;

uiT35 = 128;

main(){

//i leave out PLL locking and so on

 

   T1CON = 0x080;
   T1LD = uiT35*1343; //convert to ~same time as with 32kHz clock input

   FIQEN = GP_TIMER_BIT;
   while(1){
      if(iFlag == 1){ //this should happen every (ca) 5ms
         iFlag = 0;
           iMasterWrite("a", 1);
         T1LD = uiT35*1343;
         T1CON = 0x080;
   }
}
}

 

void My_FIQ_Function() {

   unsigned long ulFiqsta = FIQSTA;
   if(ulFiqsta & GP_TIMER_BIT){ 
      char cTest[1] = "c";
      cTest[0] = T1CON;
      iMasterWrite(cTest, 1); //write to UART. this returns correctly 0x80
      T1CLRI = 0; //clear

      T1CON = 0x000; //stop timer
      iFlag = 1;
   }
return ;
}

 

Not working due to not clearable interrupt:

 

 

int iFlag = 0;

uiT35 = 128;

main(){

//i leave out PLL locking and so on

 

   T1CON = 0x280; 
   T1LD = uiT35; 

   FIQEN = GP_TIMER_BIT;
   while(1){ 
      if(iFlag == 1){ //this should happen every (ca) 5ms
         iFlag = 0;
        iMasterWrite("a", 1); 
         T1LD = uiT35;
         T1CON = 0x280; 
   }
}
}

 

void My_FIQ_Function() {

   unsigned long ulFiqsta = FIQSTA;
   if(ulFiqsta & GP_TIMER_BIT){ 
      char cTest[1] = "c";
      cTest[0] = T1CON;
      iMasterWrite(cTest, 1); //write to UART. this returns 0x80 the first time, but then 0x00 all the time 
      T1CLRI = 0; //clear

      T1CON = 0x200; //stop timer
      iFlag = 1;
   }
return ;
}

Outcomes