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.

Interrupts in NHET module

Other Parts Discussed in Thread: HALCOGEN

1. I am able to measure the frequecy of input signal using the PCNT instruction. I would like to know how to trigget the interrupts when the fresh data is available in Data filed ? There is IRQ bit in the instruction by which i can enable the interrupt generation. But can anyone guide me how to handle this interrupt ? i mean what is the address of  ISR routine that will be invoked once the fresh data is available ? Please guide me in implementing ISR routine for this.

2. Currently i am reading the counter value from the HET RMA only. What is advantage of HTU module and how to use it ?

  • Bindu,

    Have you looked at the app notes on the Hercules web pages?  such as www.ti.com/lit/SPNA137 on HTU use.  Was it helpful?  Also, you may find the soon to be publishe app note of HEt tutorials helpful as well: www.ti.com/lit/spnu485




  • Hi Bindu

    1. I am able to measure the frequecy of input signal using the PCNT instruction. I would like to know how to trigget the interrupts when the fresh data is available in Data filed ? There is IRQ bit in the instruction by which i can enable the interrupt generation. But can anyone guide me how to handle this interrupt ? i mean what is the address of  ISR routine that will be invoked once the fresh data is available ? Please guide me in implementing ISR routine for this.

    Prathap-->
           -- In HET the interrupts are controlled by the instruction.
           -- There is an Int Enable bit in PCNT instruction which has to be set to get  interrupt when new value is captured.
           -- If you want to control the priority of the interrupts generated in NHET you can use HETPRY register.
           -- Make sure you have enabled NHET interrupt channel in the VIM module.
           -- Once PCNT data is captured, an interrupt is triggered, in the ISR you have to read HETOFF1 or HETOFF2 Register( based on Priority selcted in HETPRY) to figure out which instruction caused it. Assume your PCNT is 3rd instruction which caused the interrupt, then this register will reflect value 4. 
           -- You can read the HET RAM location for the captured data.

    2. Currently i am reading the counter value from the HET RMA only. What is advantage of HTU module and how to use it ?

    Prathap-->
           -- To put it in simple terms HTU is kind of dedicated DMA to HET, which can be configured to perform Data/control field read/write with out / very less CPU intervention.
           -- App note pointed by Brian is the right place to start.


  • Hello Prathap,

    I am using HALCOgen code, and configured it to generate PWM signal of 1KHz with 50% duty cycle and lr=(/1) and hr=(/64) settings. Such configured PWM signal is made to generate at NHET[31]. And it is working fine.

    Now, i have used CAP0 module at NHET[22] with HRSHARE=Set at bit.11 (i.e.NHET[22] HR structure will be used for PWM duty read and NHET[23] HR structure will be used for PWM period read).

    So, in NHET RAM, - following instructions were used to read PWM signal

    1. PCNT instruction (to read PWM Duty) at NHET Add.25 - Without Interrupt, Without Auto-Read Clear Data field, With Type-Select as 0x01 i.e. RISE-2-FALL pulse

    2. PCNT instruction (to read PWM Period) at NHET Add.26 - Without Interrupt, Without Auto-Read Clear Data field, With Type-select as 0x01 i.e. RISE-2-FALL pulse

    It is observed that HALCo provided function "capGetSignal( )" captures Data-field of this two PCNT instruction.

    HALCO-specific - HET Queries:

    1. How can two PCNT instruction give different Data-field value even though both are configured for same TYPE-select i.e.0x01 (RISE-2-FALL - pulse)?


    2. I have tried to enable AUTO-READ Clear Data-field feature for both PCNT instruction, and during debug - i can see that while debugging function "capGetSignal( )" - the moment i read Data-field of PCNT instruction, the Data field does not clear. Surprising.....


    3. I have tried to enable interrupt for both PCNT instruction - each instruction with same TYPE-select (ie.0x01), and written ISR for this. ISR is working but only for one PCNT instuction located at NHET address 26 (i.e.period). It is not working for NHET address.25 (i.e.duty).

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    I have written my way of generating PWM (not used HALCO code - instead used CNT, MCMP, MOV64) and read the PWM (using two PCNT instuction with different TYPE-selects (RISE-2-FALL pulse and FALL-2-FALLL period) using Interrupt method.


    PWM is generating correctly. And My ISR is also executing for both PCNT instruction with AUTO-READ Clear Data feature. Query: In my case, Problem statement is - to catch interrupt and execute ISR, i have re-apply PWM signal every time (i.e.manually remove and apply again). Don't know what could be the reason behind. PWM signal keeps on generating correctly with proper edges.


    Please assist. If required i could share my NHET instructions and configurations.

  • Sorry i made a typo mistake.

    Correction: hr=(/1) and lr=(/64) settings

  • Hi Rahul,

    Pls see my comments below for your questions.. I have attached a simple HET project, that can help you to get your PCNT Interrupt question answered. 2630.HetPwmTest.zip

    1. How can two PCNT instruction give different Data-field value even though both are configured for same TYPE-select i.e.0x01 (RISE-2-FALL - pulse)?

    The 2 instructions are not set for same type. If you look closely at the instructions, you can see that the bit 7 of Program field for the PCNT(period) instruction at Addr.26 is already set. So The only thing the user can toggle is whether it measures Rise-to-Rise or Fall-to-Fall.


    2. I have tried to enable AUTO-READ Clear Data-field feature for both PCNT instruction, and during debug - i can see that while debugging function "capGetSignal( )" - the moment i read Data-field of PCNT instruction, the Data field does not clear. Surprising.....

    This could be because the Input pin is getting a steady PWM as input. Even after a clear of the data field after a read, the value gets filled immediately.


    3. I have tried to enable interrupt for both PCNT instruction - each instruction with same TYPE-select (ie.0x01), and written ISR for this. ISR is working but only for one PCNT instuction located at NHET address 26 (i.e.period). It is not working for NHET address.25 (i.e.duty).

    This could be because  “Ignore Suspend”  bit is set in Global control register during hetInit(). If this bit is cleared, you can set breakpoints inside the ISRs and observe that both interrupts are getting called. This is the case for debugging. But during normal operation, these interrupts should be called even if this bit is set.