This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HET BR Instruction NAF_global event interrupt Problem?

I read HWAG angle value and wanted to compare angle value.

Thus I used interrupt at NAF_grobal event of HET BR instruction.

But whenever interrupt was generated, the problem was generated.

Often angle value is  wrong.

I want to know reason of this problem.

/////////////////////// ISR ///////////////////////////

if(Gap_findFlag&&Gap_count >=1)
  {
      hetREG1 -> INTENAC = 0x00000002;
      check = hetREG1->HWAACNT;

   if(hetREG1->HWAACNT==0)
   {
    het_count1 = hetREG1->HWAACNT;

   }

   Acnt_count_buffer[het_count1++] = hetREG1->HWAACNT;

    if(hetREG1->HWAACNT == 1)
      {
       het_count2++;

      }else if(hetREG1->HWAACNT == 500)
      {
       het_count3++;
      }


    hetREG1 -> INTENAS = 0x00000002;
   }

///////////////////////////////////////////////////////////////////////

  • DaeCheol,

    Is it possible that:

    a) you're giving an input that has some acceleration

    b) around the acceleration when ACNT goes into the fast mode, some counts are missed because the ISR latency is longer than one HET loop?

     

  • Thank you for your answer

    a) you're giving an input that has some acceleration

    -> 

    Input pulse : 500 Hz

    actual teeth : 179(missing tooth : 1 )

    step_width : 32

    Angle Count MAX : 5760

    RPM : 168

    b) around the acceleration when ACNT goes into the fast mode, some counts are missed because the ISR latency is longer than one HET loop?

    ->

    VCLK2 100MHz

    HR prescale : 0

    one loop resolution period : 64

    I did as above.

    one loop resolution period : 64  is longer than ISR latency ??

    Do I lengthen Loop Resolution period?