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.

CCS/TMS570LS1114: Include code instructions written in HET IDE to already existing HalCoGen project

Part Number: TMS570LS1114
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Dear support team,

in our project, we already have quite a huge functionality assigned to the NHET modules.
Nontheless, one of these functions can be coded more efficiently in the HET IDE using the simple instruction set.

My question is now, whether I can include this function coded via HET IDE in our already existing HalCoGen project, or do all other functions then also have to be coded using the HET IDE? 

The function only uses 6 input pins from the NHET module. The other functions then don't need to work with this pins.

Thank you, kind regards and stay healthy

Sebastian 

  • Hello,

    1. You can not append the code generated by HET IDE directly to the code generated by HALCoGen. I'd like to merge the code together using HET IDE.

    2. You can use N2HET1 for the NHET code generated by HALCoGen, and use N2HET2 for your other code generated by HET IDE。

  • Hello QJ,

    thank you for the fast reply. 

    I don't quite get what you are suggesting.

    Firstly, I unfortunately can't do option 2) because I need more then N2HET2 for the remaining operations, but thanks for the suggestion. 

    Secondly: How do you merge the code together using HET IDE? 

    So I can not go into HalCoGen and ->HETx-> Nhet Driver Settings and include the Header and Source File from the HET IDE, while also maintaining different configuration I set in the HalCoGen, like Edge Interrupts etc. ? 

    Thank you and kind regards

    Sebastian 

  • Hello,

    hereby I send you the example:

    The current Het.c and Het.h from HalCoGen can be found in the attachements.

    83771.het.c2117.het.h

    Using the HET IDE I want to add the following functionality: 

    A0 ECNT { control=ON,pin=24,event=ACCULOW,reg=NONE,data=0};
    A1 ECNT { control=ON,pin=8,event=ACCULOW,reg=NONE,data=0};
    A2 ECNT { control=ON,pin=14,event=ACCULOW,reg=NONE,data=0};
    A3 CNT { angle_count=OFF,reg=NONE,control=ON,max=300000,data=0};

    Assembling these lines and including the Source and Header File in HalCoGen will result in the following files ( newHet.zip). I want to mantain the previous configurations and only want to add the 4 lines of code. Is there a way to add these lines manually in the original het.c/het.h? Or is programming everything new in the HET IDE the easier solution? 

    5287.newHet.zip

     

    Thank you and kind regards

    Sebastian 

  • Hello,

    also, the only functionality enabled in HalCoGen is a 50% duty cycle 10.000µs Period time PWM output on pin 13. 

    These are the lines of code in the original het.c. ,which seem to be responsible for the PWM output: 

    /* CNT: Timebase
    * - Instruction = 0
    * - Next instruction = 1
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = na
    * - Reg = T
    */
    {
    /* Program */
    0x00002C80U,
    /* Control */
    0x01FFFFFFU,
    /* Data */
    0xFFFFFF80U,
    /* Reserved */
    0x00000000U
    },
    /* PWCNT: PWM 0 -> Duty Cycle
    * - Instruction = 1
    * - Next instruction = 2
    * - Conditional next instruction = 2
    * - Interrupt = 1
    * - Pin = 13
    */
    {
    /* Program */
    0x000055C0U,
    /* Control */
    (0x00004006U | (uint32)((uint32)13U << 8U) | (uint32)((uint32)3U << 3U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    /* DJZ: PWM 0 -> Period
    * - Instruction = 2
    * - Next instruction = 3
    * - Conditional next instruction = 41
    * - Interrupt = 2
    * - Pin = na
    */
    {
    /* Program */
    0x00007480U,
    /* Control */
    0x00052006U,
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },

    /* MOV64: PWM 0 -> Duty Cycle Update
    * - Instruction = 41
    * - Next instruction = 42
    * - Conditional next instruction = 2
    * - Interrupt = 1
    * - Pin = 13
    */
    {
    /* Program */
    0x00054201U,
    /* Control */
    (0x00004007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)13U << 8U) | (uint32)((uint32)3U << 3U)),
    /* Data */
    768U,
    /* Reserved */
    0x00000000U
    },
    /* MOV64: PWM 0 -> Period Update
    * - Instruction = 42
    * - Next instruction = 3
    * - Conditional next instruction = 41
    * - Interrupt = 2
    * - Pin = na
    */
    {
    /* Program */
    0x00006202U,
    /* Control */
    (0x00052007U),
    /* Data */
    1152U,
    /* Reserved */
    0x00000000U
    },

    As far as I understand, I can reverse engineer these instructions into the HET IDE in order to get the same pwm output? 

    Thanks and kind regards

    Sebastian 

  • This app note includes a listing of the HET program used in HALCoGen. You can paste it into a new project in the HET IDE and make edits.

    www.ti.com/.../spna225.pdf

  • Hell Sebastian,

    The HALCOGen HET.c contains the c code of instructions for generating 8 PWMs (PWCNT for duty cycles, and DJZ for period), instructions for 8 edge detections (ECNT), instructions for period and duty cycles capture (PCNT), and also the instructions for updating the data field/control field of the instructions for PWM generation(PWCNT, DJZ).

    To merge the HALCOGen het code and your code, you have to convert het1PROGRAM[xx] to instruction sets used in HET IDE.

  • Understood, thank you! Awesome support! :)