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.

TMS570LS1114: N2HET Capture Functionality

Part Number: TMS570LS1114
Other Parts Discussed in Thread: HALCOGEN

Dear support team,

in order to check incoming pulse-signal frequencies, I tried to use the capture function of the N2HET module.

The values are then read in CCS via capGetSignal(). In HalCoGen, I get the informationm, that HR share must be enable for Pin n and n+1.  ( LIMITATION ! )

So that means, that I managed to read the right frequency, if the incoming signals are not pinned on neighbouring pins, e.g. it didn't work, if I try to measure a signal frequency on N2HET[12] and a different one on  N2HET[13]. 

The problem is, that my hardware design forces me to calculate incoming frequencies on neighbouring pins. Can capGetSignal() be modified in such a way, that the limitation mentioned above is no longer a problem?

Thank you and kind regards

Sebastian 

  • Hello Sebastian,

    You don't have to use HR share, AND share, and XOR share.

    HR share is used for input capture. 2 HR structures (n, n+1) are used for 1 pin (n).  For each N2HET pin, only one instruction specifying a high resolution operation (hr_lr = HIGH) is allowed to execute per loop resolution period. If HR share is enabled, you can have 2 high resolution operation for 1 input pin per LRP.

    The input signal is always connected to pin n if HR share is enabled. pin n+1 can be used as GIO. 

    If you want to measure the frequency and duty cycle for the input signal at pin 12, the instructions shold be used like this:

    L00 PCNT { next=L01, type=rise2fall, pin=12 }
    L01 PCNT { next=L00, type=fall2rise, pin=13 }

    The H2ET[13] HR structure is also connected to the H2ET[12] pin. The L00_PCNT data field is able to capture a high pulse and the L01_PCNT captures a low pulse on the same pin (N2HET [12] pin).

    If you want to measure the frequency and duty cycle for input signals at pin 12 and pin 13, the HR share feature should not be enabled. 

  • Hello QJ, 

    thank you for the fast reply. 

    Unfortunately, I just can't seem to measure frequency and duty cycle for input signals at pin 12 and 13. I tried disabling HR share before, but it still didn't work.

    For example, I tried to measure a 50% duty cycle, 100µs period, signal on both pins. 

    When i first connect the signal to pin number 12, I get the right period but no duty cycle ( value 0 ). If I connect it to pin number 13 afterwards, I do get the duty cycle, but no period ( period stays the same ). 

    If I do the procedure starting with pin 13, I get nothing  ( duty cycle and period = 0 )  first, and then also both values right.4861.eCapDummy.zip

    You can find my HalCoGen settings and my Main source in the attachements.

    I

    Thank you and kind regards

    Sebastian 

  • Hello,

    I noticed that the code generated through the HALCoGen is for even pin only (12 or 14).

    If the pin is 12, the HR structures of pin 12 and pin 13 are used for capture 

    If you use pin 12 for one input signal, and use pin 13 for 2nd input signal, you can not use the code generated through HALCoGen, and you have to modify the following code manually (in het.c).

    /* PCNT: Capture Period 0
    * - Instruction = 26
    * - Next instruction = 27
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = 4 + 1
    */
    {
    /* Program */
    0x00036E80U | (uint32)((uint32)0U << 6U) | (uint32)((4U) + 1U),
    /* Control */
    0x00000000U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* PCNT: Capture Duty 1
    * - Instruction = 27
    * - Next instruction = 28
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = 12
    */
    {
    /* Program */
    0x00038E00U | (uint32)((uint32)0U << 6U) | (uint32)(12U),
    /* Control */
    0x00000000U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* PCNT: Capture Period 1
    * - Instruction = 28
    * - Next instruction = 29
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = 12 + 1
    */
    {
    /* Program */
    0x0003AE80U | (uint32)((uint32)0U << 6U) | (uint32)((12U) + 1U),
    /* Control */
    0x00000000U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* PCNT: Capture Duty 2
    * - Instruction = 29
    * - Next instruction = 30
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = 13
    */
    {
    /* Program */
    0x0003CE00U | (uint32)((uint32)0U << 6U) | (uint32)(13U),
    /* Control */
    0x00000000U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* PCNT: Capture Period 2
    * - Instruction = 30
    * - Next instruction = 31
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = 13 + 1
    */
    {
    /* Program */
    0x0003EE80U | (uint32)((uint32)0U << 6U) | (uint32)((13U) + 1U),
    /* Control */
    0x00000000U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },

    I suggest you use pin 12 for first input signal, and use pin 14 for 2nd input signal. So you can use the HalCoGen code directly.