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.

TMS570LS3137: HET interrupts

Part Number: TMS570LS3137

Hi Team,

I am using HET module with interrupts configured as HET level 1. In micro instruction, I am expecting to get interrupt when the pulse count reaches to a 6 and pulse count is incremented using PCNT instruction.
LRP is 6.4 usec. So, ideally, i should get interrupts for every 40usec. But, i am getting interrupts around 15 usec. Can you please check this behavior and let me know your inputs?
I verified the pulse count value for every interrupt and its value is 6.

  • Hello,

    Could you please share your LRP calculations and a dump of the NHET registers? Have you tried simulating your program using the HET IDE as described in the following app note?

    http://www.tij.co.jp/jp/lit/an/spraba0b/spraba0b.pdf

    Regards,
    Sahin

  • No, I haven't tried simulation part. Please find the snapshot of the HET configuration. Note: HCLK is 180MHz and VCLK2 is 20 MHs.

    Even, i tried to generate interrupt for every time PCNT instruction gets executed, but interrupt is not generated. Can you check it?

  • Any updates on this?

  • Hi,

    To be more specific,

    L00 PCNT { hr_lr=HIGH,next=L01,type=RISE2RISE,pin=0};
    L01 ECNT { next=L00,cond_addr=L02,pin=0,event=FALL,reg=A,data=0};
    L02 ADD { src1=REM,src2=IMM,dest=IMM,next=L03,remote=L00,data=0};
    L03 ECMP { next=L00,en_pin_action=OFF,cond_addr=L00,pin=0,reg=A,irq=ON,data=1};

    .....

    With the above instructions, for the given input signal of 24KHz, the number of pulse count in pcnt instruction should be 6 which is expected, but interrupt period is not at approx 40usec. Instead it is coming around 20 usec (which is half of the input signal, this we tested for other input frequency values).

    But, when we configure ECNT instruction with event as FALL, we are getting correct time measurement values. Any specific reason for this behaviour?

  • Part Number: TMS570LS3137

    Hi team,

    This is the continuation of the below case:

    Can you please look into this and share your inputs?

    Regards,

    M.Sreenivasan.

  • VCLK2 frequency must be an integer multiple of VCLK frequency, as specified in SPNU499C, section 2.4.2 "Clock Domains" on page 119.

    What is the VCLK set to with VCLK2 of 20MHz?

  • Both are configured to 20MHz and hclk is 180MHz

  • Hello,

    For debugging HET programs, we recommend using HET IDE. It can be downloaded here: http://www.ti.com/tool/HET_IDE

    sreenivasan m said:

    L00 PCNT { hr_lr=HIGH,next=L01,type=RISE2RISE,pin=0};
    L01 ECNT { next=L00,cond_addr=L02,pin=0,event=FALL,reg=A,data=0};
    L02 ADD { src1=REM,src2=IMM,dest=IMM,next=L03,remote=L00,data=0};
    L03 ECMP { next=L00,en_pin_action=OFF,cond_addr=L00,pin=0,reg=A,irq=ON,data=1};

    Is this the full program code? If not, could you please post the entirety of it?

    I don't follow what you are doing with the ADD instruction - for example, lets say:

    1st loop: PCNT instruction detects rising edge and starts counting. ADD instruction adds this value (let's assume it's 1) with 0 (for the 1st loop) and stores it. So data == 1. 

    2nd loop: Let's say PCNT does not detect the 2nd rising edge, so it is still incrementing, let's say it's now 2. The ADD instruction will then add this incremented value with the previous value, so 2+1, data now == 3. 

    Is this the behavior you are expecting? I assume you are looking to measure the period duration, which is what PCNT already does so you would not need the ADD instruction. Let me know if this assumption is incorrect. It would be good if you could give a description what you are trying to accomplish with the above HET code as well.

    Regards,
    Sahin

  • Hi

    Your assumption is correct above and program mentioned is correct. After Ecmp instruction, we will clear data portion of l01 and l02 instruction.

    Can you try at your end and see at what rate interrupts are generated and let us know your inputs for our questions.

    L00 PCNT { hr_lr=HIGH,next=L01,type=RISE2RISE,pin=0};
    L01 ECNT { next=L00,cond_addr=L02,pin=0,event=FALL,reg=A,data=0};
    L02 ADD { src1=REM,src2=IMM,dest=IMM,next=L03,remote=L00,data=0};
    L03 ECMP { next=L00,en_pin_action=OFF,cond_addr=L04,pin=0,reg=A,irq=ON,data=6};
    L04 MOV32 { next=L05,remote=L01,type=IMTOREG&REM,reg=NONE,data=0};
    L05 MOV32 { next=L00,remote=L02,type=IMTOREG&REM,reg=NONE,data=0};

    Let me know if you need any further information on this.

    So, for the given input square waveform with 50% duty cycle, with ECNT instruction event is configured to BOTH, below are the observations:

    1. HCLK=180MHz, VCLK=20MHz.
    2. LRP is set to 6.4usec.
    3. For input signal of 24KHz, the number of pulse count in PCNT instruction is 6 (1/24Mhz = 41.2usec and 6*6.4 is approx 38 usec).|
    4. So, the period between interrupts should be expected to have a value of 38 usec, but we are getting half of it.
    5. When we perform the same with ECNT event configured to FALL, we are getting expected value. Can you please check this behaviour and let me know is there any known issue with ECNT instruction
    when event is configured to BOTH with respect to interrupt generation (HET interrupt).

  • Any response to the above comment? Are you able to reproduce the problem?

  • Hello,

    You still have not explained what you would like your HET program to do. If you just want to measure the period of the input signal, the PCNT instruction should be sufficient. I don't understand what the other instructions are there for. 

    Please review the following application note which contains an example on measuring the period of an input signal. 

    Leveraging the High-End Timer Transfer Unit on Hercules TMS570LS

    As mentioned previously, this is why we recommend simulating using the HET IDE. It will give you better insight into what your HET instructions are doing.

    Regards,
    Sahin

  • Hi Sahin,

    Not sure clearly what is required. We want to calculate pulse counts for some periods of input signal and in he above code, it is for 1 period. Here are few questions asked and could not get answers to any one of them. I already mentioned, we are having some issues in simulator and more over I was giving you the results on testing in target.

    1. Have you tried to reproduce the problem and see interrupts are getting generated at expected intervals when ecnt instruction is configured to count the event from rise to fall instead of fall to fall?

    2. When we configured pcnt instruction with interrupts enables, interrupts are not generated.

    If more clarification is required, please set a call request, so that we can discuss and close this issue sooner.

    Thanks for understanding.

  • Any updates on the interrupt behaviour please?

  • Hi Sreenivasan,

    1. I haven't tried reproducing the problem, but it makes sense that you would be getting interrupts at half the interval when counting both edges instead of one edge as the count number would double. You would need to double the value of the data field of the ECMP instruction from 6 to 12 when counting both edges. Please let me know if this isn't clear. 

    2. Could you please provide more details - do you mean when you just use the PCNT instruction alone or with the entire HET program code above? What are the parameters of the PCNT instruction?

    Regards,
    Sahin

  • Hi Sahin,

    1.As per TRM, in ECNT instruction, event counts was configured to BOTH means, it will increment the count only when rise and falling edges were detected. How does it increment to 2. Can you please help us to show in the waveform. I would see ECNT instruction will increment count by 1 when both edges are detected and it will be incremented for every period of the input signal.

    Can you please prioritize this issue as we need to know the behaviour of ECNT instruction when event trigger was configured to BOTH?

    2.Yes, we used only PCNT instruction with interrupt enabled and its not working.

  • ECNT increments event count on both rising and falling edges when you select "BOTH" as the event. In your case, if you want to generate interrupt using ECNT, you need to configure the compare value correctly by counting both rising and falling edges expected.

  • Sorry Sunil, as per TRM event count will increment by 1 when both rise and fall edges are detected in input signal, but not by 2 as per your comment. We are getting correct period values as per ecnt, but not interrupts. Can you please try to reproduce the problem and check and share the timing diagram as well.

  • Any updates on this?

  • I have confirmed that the below statement is correct:

    ECNT increments event count on rising and falling edges when you select "BOTH" as the event.

    That means that ECNT counts rising edges as well as falling edges.

  • From Table 20-85,  under count conditions, it says Rising and Falling edge on selected pin. Does it not mean that it will count only one when it encounters both rise and falling edge? There is no 'OR' between Rising & Falling

  • It means that the event count will increment on both rising and falling edges. I will submit doc feedback to clarify this.

  • Thanks Sunil, please do let us know the document version with which it will be fixed.

    Also, what about PCNT instruction with Interrupt enable behaviour?