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.

  • Resolved

Het and HWAG question?

Prodigy 230 points

Replies: 6

Views: 881

I want to know more information about HET and HWAG.

I would like to compare HWAG Angle register value.

But RTOS is not checked whenever angle value is changed.

So,  I want to know whether HWAG angle value is available compare through  HET ACMP instruction .

By the other way let me know please,  If it way is not compare.

Also ACMP instruction is compared what using the register?

And how to access  is it?

  • Hello DaeCheol Kang,

    We received your post. The HWAG capability of the N2HET has not been thoroughly documented so I understand why you would have these questions.

    I asked one of our experts to respond.

    Best Regards,

    Brian Fortman                  

    Industrial Drives and Automation              

    C2000 Microcontrollers

  • Hi DaeCheol,

    DaeCheol Kang
    I would like to compare HWAG Angle register value.

    There isn't any way to compare against the ACNT register in the HWAG.  You can read the register with the CPU and compare in the CPU but there's no hardware compare.

    Instead the NHET keeps it's own ACNT using the ACNT instruction and the angle *increment* information from the HWAG.  This is all that you can compare against using the N2HET.

    DaeCheol Kang
    But RTOS is not checked whenever angle value is changed.

    I don't understand the question w. regards to the RTOS.   Did you want an interrupt on angle increment or something?

    DaeCheol Kang
    So,  I want to know whether HWAG angle value is available compare through  HET ACMP instruction .

      Same as above, the ACMP instruction compares a register.  The register should hold the angle count, and this means that the ACNT instruciton has to be run prior to the ACMP instruction.   The ACNT instruction creates the same sort of count as the ACNT register in the HWAG however the two are independent and operate in parallel.   They don't necessarily have the same value because they operate on an angle 'increment' -- hence there could be an absolute difference between the two counters depending on how you reset them.

    DaeCheol Kang
    Also ACMP instruction is compared what using the register?

    It is in the psuedo-code for the ACMP instruction in the TRM.   The summary is that the ACMP instruction will trigger when the compare value falls between the previous ACNT value and the new ACNT value.  You need to have run the ACNT instruciton to put the ACNT value in a register before running ACMP.

    And this is subtle but the OLD counter value isn't stored it is CALCULATED, it is not stored in memory.
    So if you force some change to the angle count between loops, the compare is done by subtracting the current increment from the new counter value to calculate what the old counter value would have been.  If you write over the count, then the actual counter value from the previous loop may not be the same as the 'old counter value'. 

    DaeCheol Kang
    And how to access  is it?

    ACNT writes the result to "B" and so normally your ACMP would compare against register "B".  But you could move things around and specify a different register if you need additional logic to handle boundary cases.

    Best Regards,
    Anthony Seely

    If my reply answers your question please click on the green button "Verify Answer".

  • In reply to Anthony F. Seely:

    Thank you for your answer.

    I'm sorry that question was not detailed.

    Input Pulse is 179. (missing tooth = 1)

    HWAG Angle value is incremented into STWD(Step Width) is 32 per period. 

    RTOS is not continually checked because different work is executed.

     

    I don't understand the question w. regards to the RTOS.   Did you want an interrupt on angle increment or something?

    ->  I want same the Tooth Interrupt an interrupt in angle value.

         However, that was not to be.

    1) Angle "increment" information is how to check in ACMP instruction?

    2) What is the Software Angle Generator and HWAG difference?

    3) May I use the following code?


    L00   CNT { next=L01,angle_count=ON,reg=B,comp=EQ,irq=OFF,max=5760,data=0};

    L01   BR { next=L00,cond_addr=L02,event=NAF};

    L02   ACM{ next=L00,reqnum=4,request=GENREQ,en_pin_action=ON,pin=29,action=SET,reg=B,irq=ON,data=20};

        

  • In reply to DaeCheol Kang:

    Hi DaeCheol,

    DaeCheol Kang
    ->  I want same the Tooth Interrupt an interrupt in angle value.

         However, that was not to be.

    OK I think I understand but I want to see if I understand correctly.
    Did you want to perform the angle compare IN THE HWAG and generate the interrutp FROM THE HWAG?

    If so then you are right, this capability is not in the HWAG.  The HWAG interrupts are mostly exceptions (aside from the tooth interrupt which isn't 'selective' about which tooth...)

    DaeCheol Kang
    1) Angle "increment" information is how to check in ACMP instruction? 

    I am not sure I understand this question, but the angle 'increment' is estimated either by the hardware angle generator, or by the software angle generator.   This incremental value is passed to the ACMP instruction.  It it subtracted from the 'current' angle count to get the value of last angle that is used in the comparison.

    DaeCheol Kang
    2) What is the Software Angle Generator and HWAG difference?

    Thank you for finding my mistake and changing your code to show CNT instead of ACNT.

    The difference between the software and hardware angle generator methods are mainly in two areas:

     - estimation of angle increment done in hardware rather than by HET instructions

      - detection of anomolies (gap, missing tooth, etc) also done in HWAG hardware rather than software

    The ACNT instruciton is the counter for estimating the angle incrment for each PLL loop, not the actual angle counter like I mentioned above - thanks for correcting this.   CNT in angle mode is your angle counter as you show below.

    So with the hardware angle generator you don't need the ACNT as the increment value comes from the HWAG.  You just need to accumulate this increment into the angle counter in the CNT instruction.  And the increment value is also not limited to +1 or 0 when there is HWAG.   So HWAG can handle faster rotation and higher interpolation factors.

    The angle counter (CNT instruction) and compares based on this count are basically the same for the HW and SW angle generators. 

    The HWAG also detects some exceptions that you might have to write code for in the software angle generator only approach.  

    DaeCheol Kang
    3) May I use the following code?


    L00   CNT { next=L01,angle_count=ON,reg=B,comp=EQ,irq=OFF,max=5760,data=0};

    L01   BR { next=L00,cond_addr=L02,event=NAF};

    L02   ACM{ next=L00,reqnum=4,request=GENREQ,en_pin_action=ON,pin=29,action=SET,reg=B,irq=ON,data=20};

    Something like this looks right.  I don't know about the data = 20 and how this translates to the 179th tooth but maybe these are not supposed to be the same.   Also the ACM should be ACMP.  

     

    Best Regards,
    Anthony Seely

    If my reply answers your question please click on the green button "Verify Answer".

  • In reply to Anthony F. Seely:

    Thank you for your answer

    I solved my problem below code.


    L00   CNT { next=L01,angle_count=ON,reg=B,comp=EQ,irq=OFF,max=5760,data=0};

    L01   BR { next=L00,cond_addr=L02,event=NAF};

    But I want to do other question.

    I want to know the minimum action clock in HWAG.

    1Hz pulse was inputs but HWAG was not initialization when teeth counter was maximum teeth num.

  • In reply to DaeCheol Kang:

    Hi DaeCheol,

    I'm sorry I don't understand the last question. 

    There is a limit on the maximum input frequency versus the HET loop resolution period.

    The maximum angle increment is +15 so each loop needs to be short enough so that the angle increment can be in the range of +0 to +15.   

    The formula for this is:     Maximum HET Loop Resolution Period =  15 x Minimum Tooth Period /  Step Width.

    But I don't think you would be running into this limit at 1Hz for your input pulse.

     

    Best Regards,
    Anthony Seely

    If my reply answers your question please click on the green button "Verify Answer".

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.