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: Clarification on N2HET in TMS570LS3137 (HALCoGen-Generated)

Part Number: TMS570LS3137

Tool/software:

Hello everyone,

I'm currently working with the N2HET peripheral on the TMS570LS3137 microcontroller. After reviewing the technical reference manual to understand the capabilities of the N2HET module, I explored the HALCoGen-generated code to see how PWM and other timing functions are implemented. However, I encountered a section that I'm having trouble understanding.

Specifically, in the pwmStart function, the following code is used:

void pwmStart(hetRAMBASE_t * hetRAM, uint32 pwm)
{
hetRAM->Instruction[(pwm << 1U) + 41U].Control |= 0x00400000U;
}

I'm trying to understand the logic behind the expression [(pwm << 1U) + 41U]. I assume that the pwm parameter refers to a specific PWM channel, but I couldn’t find clear documentation explaining why the index calculation is done this way, or how it maps to the actual instructions used to control PWM behavior in the N2HET RAM.

Additionally, I’d like to know more about how to determine which HET instruction index to use for operations like starting/stopping PWM or reading edge counters. The reference manual provides instruction details but doesn’t seem to explain how those are organized or accessed.

Could someone explain:

  1. How the instruction indexing (e.g., (pwm << 1U) + 41U) is determined?

  2. Where this mapping between PWM channels and instruction RAM locations is defined?

  3. How to properly interface with the N2HET instruction set to perform actions like starting/stopping PWM or reading counters?

Any clarification or pointers to documentation/examples would be greatly appreciated.

Thanks in advance!

  • Hi Berat,

    Actually, from instruction 41 onwards there will be a MOV64 instructions which will be helpful to modify the control and data values of the PWM's.

    There will be two instructions for every PWM, one for duty cycle updation and other one is for period updation.

    If we see the remote instruction value for instruction-41 it is 1, and similarly for instruction-43 it is 3 etc.

    So that means the values that we are upating into this MOV64 instructions will actually modifies the instructions in remote locations. This is using for smooth updation of the duty and period values, i mean kind of double buffering.

    For example if we are calling the below API for pwm0 means that we are indirectly activating 22nd bit in the instruction-1.

    That means we are setting 22nd bit in the control field of PWCNT instruction.

    Which is "Enable pin action".

    By default, this pin value is zero that means pin action is in disabled state. That means even though counters are running there won't be any pin action that means we can't see any PWM signal on the output pin. So, when we call this "pwmStart" API for corresponding PWM then it is enabling pin action to generate actual PWM on the pin.

    --
    Thanks & regards,
    Jagadish.