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.

TMS570LC4357: setup NHET ECMP instruction to set or clear a N2HET pin

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

I have the following code in the HET IDE.  It checks whether n2HET1[18] pin is either HIGH or LOW and I want to set/clear N2HET1[8] accordingly.   I am using the ECMP instruction pin action to set/clear the pin.  The code below shows the simulator following but running on actual hardware it is not triggering (I am using the N2HET1[8] as the trigger source for the MIBSPI Transfer group.

L00 CNT { next=CheckLow,reg=T,comp=EQ,max=0x1FFFFFF,data=0x1FFFFFF};
CheckLow BR { next=SetLow,cond_addr=CheckHigh,pin=18,event=HIGH};
SetLow ECMP { next=NextInLine,control=ON,en_pin_action=ON,cond_addr=NextInLine,pin=8,action=CLEAR,reg=A,irq=OFF,data=0};
CheckHigh BR { next=SetHigh,cond_addr=NextInLine,pin=18,event=LOW};
SetHigh ECMP { next=NextInLine,control=ON,en_pin_action=ON,cond_addr=NextInLine,pin=8,action=SET,reg=A,data=0};
NextInLine PWCNT { next=0,cond_addr=0,pin=0,reg=A,data=0};

  • Hello Nino,

    1. In HALCoGen, enabled NHET module

    2. Configure the pin mux to use NHET pins

    3. Configure NHET pin 18 as input, and pin 0 and pin 8 as output

    4. Copy an past the NHET IDE generated  C Code to het.c as an data array:

    HET_MEMORY const HET_INIT0_PST[6] =

    {

    /* L00_0 */

    {

    0x00002C80,

    0x01FFFFFF,

    0xFFFFFF80,

    0x00000000

    },

    /* CheckLow_0 */

    {

    0x00005A00,

    0x000072E0,

    0x00000000,

    0x00000000

    },

    /* SetLow_0 */

    {

    0x0000A000,

    0x0440A800,

    0x00000000,

    0x00000000

    },

    /* CheckHigh_0 */

    {

    0x00009A00,

    0x0000B2C0,

    0x00000000,

    0x00000000

    },

    /* SetHigh_0 */

    {

    0x0000A000,

    0x0440A810,

    0x00000000,

    0x00000000

    },

    /* NextInLine_0 */

    {

    0x000014C0,

    0x00000000,

    0x00000000,

    0x00000000

    }

    };

    5. Modify the following code in hetInit() function to program your NHET code to NHET RAM

       change:    (void)memcpy((void *)hetRAM1, (const void *)het1PROGRAM, sizeof(het1PROGRAM));

       to:   (void)memcpy((void *)hetRAM1, (const void *)HET_INIT0_PST, sizeof(HET_INIT0_PST));

    6. Compile your project and load the code into flash

    7. Add a breakpoint at the line next to hetInit() in your main function

    8. Open memory browser, and check the content in NHET RAM starting at: 0xFF460000, and make sure you code is copied to this location correctly.

     

  • I created the NHET assembly code to properly following the state of the input pin and generate the correct signal on the NHET1[8] pin, I was able to make use of an external signal to trigger the MIBSPI.

    Issues I have seen so far, 

    1. Compared to the GIOAx trigger, the NHET1x cannot use the TRIG_LOW.  It has to be configured for TRIG_FALLING.  If I use TRIG_LOW, it will keep on being triggered and prevent any low priority transfer group from being serviced.

    For now, I am okay with my implementation.